Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
const puppeteer = require('puppeteer');
const download = require('image-downloader');
(async() => {
const browser = await puppeteer.launch();
console.log('Browser openned');
const page = await browser.newPage();
const url = '';
await page.goto(url);
console.log('Page loaded');
const imgLinks = await page.evaluate(() => {
let imgElements = document.querySelectorAll('.sp-img-zoom > img, .sp-img-lightbox > img, .detail-img-lightbox > img');
imgElements = [...imgElements];
let imgLinks = => i.getAttribute('src'));
return imgLinks;
// Tải các ảnh này về thư mục hiện tại
await Promise.all( => download.image({
url: imgUrl,
dest: __dirname
await browser.close();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment