Giter Club home page Giter Club logo

Comments (7)

ururk avatar ururk commented on September 17, 2024

The other possibility is that ksb._kvc never appears on the page sometimes.
Definitely not this. I also had to bump up my time to 2 seconds, which seems to be working much better.

from images-scraper.

pevers avatar pevers commented on September 17, 2024

Thanks for finding this issue @ururk

I think it would be better to wait for page load. That can be achieved by doing this as part of the goto.

await page.goto(query.replace('%', encodeURIComponent(self.keyword)), {
  waitUntil: 'networkidle0'
});

from images-scraper.

ururk avatar ururk commented on September 17, 2024

Great! I'm still getting the same issue though - page loads but does not find any results. What I've found, is every time this happens, the meta JSON dos not load on the page (no .rg_meta element) nor are there any .rg_l elements. I see some errors in the web browser console:

Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'report-sample' 'nonce-5fBQzWdGZVpdbsJiddVttw' 'unsafe-inline'". Note that 'unsafe-inline' is ignored if either a hash or nonce value is present in the source list.

addScriptContent @ VM52 __puppeteer_evaluation_script__:7

No network errors, though, so I'm at a slight loss as to why this is happening. I even tried updating to the latest puppeteer (which includes a newer Chromium) and am still having problems.

from images-scraper.

pevers avatar pevers commented on September 17, 2024

Thanks for investigating @ururk . I can't seem to reproduce it

The error you see might be resolved by doing this: https://github.com/puppeteer/puppeteer/blob/master/docs/api.md#pagesetbypasscspenabled

Can you please try? Thanks, I'm reopening this issue.

from images-scraper.

pevers avatar pevers commented on September 17, 2024

I managed to reproduce it @ururk . I think this fixes it. I'm pushing it to a new version shortly.

from images-scraper.

ururk avatar ururk commented on September 17, 2024

This appears to fix it - I'll run some test searches and let you know how it goes.

from images-scraper.

ururk avatar ururk commented on September 17, 2024

I've done about 50 searches - this fixes the problem! I still have random Chromium crashes, but I don't think it's related to this node module's code.

from images-scraper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.