0
Facebookのビデオページをスクラップする必要がありますが、「詳細をロード」ボタンはAjaxにあります。 私はPhantomJSを使用してボタンをクリックしようとします。ファントムJSもっと多くの要素をロードする
しかし、ボタンを何度もクリックする必要があります。
だからこれは私のコードです:
var page = require('webpage').create();
page.open("https://www.facebook.com/MisterVOnline/videos", function(status) {
if (status === "success") {
page.evaluate(function() {
while(document.querySelector(".uiMorePagerPrimary")){
document.querySelector(".uiMorePagerPrimary").click();
window.setTimeout(function() {
}, 5000);
}
});
window.setTimeout(function() {
//console.log(page.content);
page.render('facebook.jpeg');
phantom.exit();
}, 5000);
}
});
whileループせずに、彼は良い負荷をしたときのコードは動作しません...
私は、誰かが私を助けることができることを願っています!