首页 > 解决方案 > 使用 Puppeteer 抓取多个图像 URL

问题描述

我目前正在尝试利用 Puppeteer 从页面上的一系列图像中获取图像 src。我确定我只是缺少对如何正确获取 src 属性的一些基本了解。这是我到目前为止所得到的:

const [img] = await page.$$('span.product-photo > img');
const src = await img.getProperty('src');
const imgURL = await src.jsonValue();

console.log(imgURL);

有了这个,我只抓取了第一个图像 src。我为这个问题多么幼稚而道歉。先感谢您!

标签: javascriptweb-scrapingpuppeteer

解决方案


推荐阅读