我正在使用幻像来抓取动态网页内容,我需要向下滚动以显示所有页面内容。
我试过这个await page.property('scrollPosition', { top: 1000, left: 0 });
,但它对我不起作用,内容仍然相同。
这是我的代码:
(async function() {
const instance = await phantom.create();
const page = await instance.createPage();
await page.on("onResourceRequested", function(requestData) {
//console.info("Requesting", requestData.url);
});
const status = await page.open(
"https://www.articles-epresse.fr/media/894eab75-c642-46a2-a1ba-b240c278ebbc?"
);
if (status == "success") {
await page.property("scrollPosition", {
top: 1000,
left: 0
});
}
const content = await page.property("content");
console.log(content);
var $ = cheerio.load(content);
任何的想法 ?
我只需要将top
的值增加到3000
,这样它就可以刮掉页面的其余部分