我正在使用 Node.js 创建一个简单的抓取应用程序傀儡师 https://github.com/GoogleChrome/puppeteer/。
我想要抓取的页面是。下面是我现在正在使用的代码。
const url = `https://www.betrebels.gr/el/sports?catids=122,40,87,28,45,2&champids=423,274616,1496978,1484069,1484383,465990,465991,91,71,287,488038,488076,488075,1483480,201,2,367,38,1481454,18,226,440,441,442,443,444,445,446,447,448,449,451,452,453,456,457,458,459,460,278261&datefilter=TodayTomorrow&page=prelive`
await page.goto(url, {waitUntil: 'networkidle2'});
let content: string = await page.content();
await page.screenshot({path: 'page.png',fullPage: true});
await fs.writeFile("temp.html", content);
//...Analyze the html and other stuff.
我得到的屏幕截图是this https://i.ibb.co/1LCJYjr/example.png这就是我所期待的。
另一方面,页面内容很少,并不代表图像上的数据。
难道我做错了什么?我没有正确等待 Javascript 完成吗?