试图用Puppeter刮苹果评论,但返回为空

mccptt67  于 2021-09-13  发布在  Java
关注(0)|答案(0)|浏览(263)

我正试图把下面所有的评论都删掉;
https://apps.apple.com/jp/app/mcdonalds-japan/id413618155?l=en#see-所有/审查
如果你能看到评论被屏蔽,那么你需要;
点击查看评论
滚动查看更多信息
我还有很长的路要走,但我已经尝试过这个代码;

import puppeteer from 'puppeteer';

const url = "https://apps.apple.com/jp/app/mcdonalds-japan/id413618155?l=en#see-all/reviews";

(async () => {

  try {

    const browser = await puppeteer.launch({
      headless: false
    });
    const page = await browser.newPage();

    await page.goto(
      url,{
      waitUntil: "domcontentloaded"
    });
    await page.waitForTimeout(4000);
    let result = await page.evaluate(() => {
      const items = Array.from(document.querySelectorAll("div"));
      return items
    })

    console.log(result);
    await browser.close();

  } catch (e) {
    console.error();
  }

})();

但是结果返回空,不确定我做错了什么。

[
  {}, {}, {}, {}, {}, {}, {}, {},
  {}, {}, {}, {}, {}, {}, {}, {},
  {}, {}, {}, {}, {}, {}, {}, {},
  {}, {}, {}
]

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题