Node.js 的 Jsoup 之类的库
Jsoup like library for Node.js
是否有 API 用于 Node.js 从 URL 和静态 html 获取和查询 html?
我喜欢做这样的事情来使用 webscrape:
Document doc = Jsoup.connect("http://en.wikipedia.org/").get();
Elements newsHeadlines = doc.select("#mp-itn b a");
我查看了这个 Question 并查看了大部分 API,但我没有发现(也许我无法识别)任何如此相似的东西。
Jsdom
大概就是你想要的https://github.com/tmpvar/jsdom
您可以将它与 jquery 结合使用来查询 dom。这是我如何在我的一个项目中使用它的示例 https://github.com/gabesoft/seryth/blob/master/lib/sanitizer.js
您可能还需要 request
从 url https://github.com/request/request
获取 html
是否有 API 用于 Node.js 从 URL 和静态 html 获取和查询 html?
我喜欢做这样的事情来使用 webscrape:
Document doc = Jsoup.connect("http://en.wikipedia.org/").get();
Elements newsHeadlines = doc.select("#mp-itn b a");
我查看了这个 Question 并查看了大部分 API,但我没有发现(也许我无法识别)任何如此相似的东西。
Jsdom
大概就是你想要的https://github.com/tmpvar/jsdom
您可以将它与 jquery 结合使用来查询 dom。这是我如何在我的一个项目中使用它的示例 https://github.com/gabesoft/seryth/blob/master/lib/sanitizer.js
您可能还需要 request
从 url https://github.com/request/request