javascript - 使用 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。我为这个问题多么幼稚而道歉。先感谢您!
解决方案
推荐阅读
- sass - 我可以在从 node_modules 中的 antd 导入样式后强制加载全局样式吗?
- ffmpeg - 使用 ffmpeg 将透明 webm 文件与 jpg/png 合并/混合/复合
- wordpress - 仅通过 HTTPS 安装官方 WordPress docker
- sendinput - VkKeyScanEx/Sendinput,英国键盘布局 (é €)
- c# - I want to spawn my zombies in my game at a random location but I want to make sure to not spawn the inside the buildings
- windows - ansible win_replace module is missing
- python - Python Spyder 5.0.0“重新加载模块”错误
- javascript - Webpack 4, watch folders outside file structure
- visual-studio-code - VSCode–Codestream Extension: Add code range link to Codestream comment thread
- c# - 无法启动进程 dotnet.exe - 输入或输出无法重定向,因为指定的文件无效