无法使用Cheerio获取iframe
您好,我正在试图从wathfree.to获得一个iframe。
这是我用于这个目的的代码:
function getSecondBody(url2) { url2 = 'http://www.watchfree.to/watch-366-Forrest-Gump-movie-online-free-putlocker.html'; request(url2, function(err, resp, body) { var $ = cheerio.load(body); var embedcode = $('.links_left_container'); embedcodetext2 = embedcode.html(); console.log(embedcodetext2); return embedcodetext2; }); }
但返回的响应不包含我需要的iframe。
这是我收到的回应:
而实际的页面如下所示:
我的回复中只有iframe部分丢失。
view-source:http://www.watchfree.to/watch-366-Forrest-Gump-movie-online-free-putlocker.html
请看看页面的来源。 没有iframe。 这是通用的内容。 所以当你请求它时,它不会加载到DOM。
如果您想要openloadembedded链接,您需要爬行可能这条线:
var locations = ["http:\/\/streamin.to\/embed-k2msgp8yhhd8-580x326.html","http:\/\/streamin.to\/embed-cbp8zxw3yo3f-580x326.html","http:\/\/embed.nowvideo.sx\/embed.php?v=2729070a4365a","http:\/\/thevideo.me\/embed-wm815ejm5uvb-580x326.html","https:\/\/estream.to\/embed-6u49dntawgr0.html","http:\/\/thevideo.me\/embed-n14mh2bjj2nz-580x326.html","http:\/\/vidtodo.com\/embed-bmjw5u1e18js.html","http:\/\/vidtodo.com\/embed-z8614uxy1824.html","https:\/\/openload.co\/embed\/xTLPXjSGz7o\/","https:\/\/openload.co\/embed\/F8gJS5Y1o1o\/"];