Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.9k views
in Technique[技术] by (71.8m points)

nodejs读取本地html文件并快速获取dom内容的工具 ?

目的:读取本地html文件,获取页面表格内容并将其输出成对应的md写法

虽然纯靠正则匹配可以实现,但这逻辑较为复杂,有没有工具可以复用呢?

html文件是其他工具生成的,不能更改,有一定规则,但会有很多冗余的代码,特征也比较乱,比如表格全是用div加样式实现的。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

用npm包咯。比如cheerio


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...