使用 Nodejs 进行抓取页面的时候,js 等都可以运行,但是页面中包含一个 iframe,输出抓取的 html 的时候,iframe 中是空的,没有 dom。用的包是 Node-phantomjs。
使用 Nodejs 进行抓取页面的时候,js 等都可以运行,但是页面中包含一个 iframe,输出抓取的 html 的时候,iframe 中是空的,没有 dom。用的包是 Node-phantomjs。
1
xycool Feb 25, 2018
phantomjs --web-security=no 试试
|
2
lemuria Feb 25, 2018
document.querySelector('selector').contentWindow.document.documentElement.outerHTML
|
3
lemuria Feb 25, 2018
|
4
gongcheng121 OP @lemuria ok,我试试,谢谢
|