images-scraper
images-scraper copied to clipboard
The "url" argument must be of type string. Received undefined
I am trying to scrape a bunch of categories, and after like 3 images, I get this error and it stops the agent from scraping more.
It does work when I don't use many categories, and for some queries, it works, so overall not stable at all for some reason.
That's my code:
const Scraper = require("images-scraper");
const google = new Scraper({
puppeteer: {
headless: false,
},
});
const categories = ["shark", "cat", "lion", "snake", "spider"];
(async () => {
try {
const results = await google.scrape(categories, 10);
results.forEach((item, index) => {
item.images.forEach((img, i) => {
//do something with images
});
});
} catch (e) {
console.log("Scraping failed", e);
}
})();
I get this issue from time to time too. Any progress?
Sorry I can't really reproduce it. Can you provide an OS and version? Can you also describe what happens when it doesn't work?
its random
I got the same error, and I fixed that here https://github.com/pevers/images-scraper/pull/107
I also got the same issue
@pevers can we get an npm release for the fix?
@pevers can we get an npm release for the fix?
I just did the release. Thanks for reminding me and sorry for the delay