问题描述
我有一个网页,其中有一些JS API不会改变dom,但返回一些数字。
我想编写一个NodeJS应用程序来下载这些页面并在下载页面的上下文中执行这些功能。
I have a web page in which there are some JS APIs that don't alter the dom, but return some numbers.I'd like to write a NodeJS application that downloads such pages and executes those functions in the context of the downloaded page.
我正在看cheerio页面抓取..虽然我看到用它来导航和操作DOM是多么容易,但我没有看到任何运行页面功能的权限。是否可以这样做?
I was looking at cheerio for page scraping.. but while I see how easy is it to navigate and manipulate the DOM with it, I don't see any access to running the page functions. Is it possible to do it?
我应该看看jsdom吗?
Should I look, instead, at jsdom?
谢谢
推荐答案
听起来你想使用PhantomJS,它将提供完全渲染的输出,然后使用cheerio。
Sounds like you want to use PhantomJS, which will provide the fully rendered output, and then use cheerio on that.
这篇关于用cheerio执行抓取的JavaScript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!