pevers / images-scraper

Simple and fast scraper for Google
ISC License
224 stars 69 forks source link

The "url" argument must be of type string. Received undefined #88

Closed nitsanasraf closed 5 months ago

nitsanasraf commented 2 years ago

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);
  }
})();
alexandrosmagos commented 2 years ago

I get this issue from time to time too. Any progress?

pevers commented 1 year ago

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?

ghost commented 1 year ago

image its random

EliuTimana commented 1 year ago

I got the same error, and I fixed that here https://github.com/pevers/images-scraper/pull/107

Dharmendra016 commented 5 months ago

I also got the same issue

kanjieater commented 5 months ago

@pevers can we get an npm release for the fix?

pevers commented 5 months ago

@pevers can we get an npm release for the fix?

I just did the release. Thanks for reminding me and sorry for the delay