LuanRT / google-this

A simple yet powerful module to retrieve organic search results and much more from Google.
https://www.npmjs.com/package/googlethis
MIT License
323 stars 77 forks source link

Error: Could not search on Google: Request failed with status code 429 #14

Closed GeistFighter closed 2 years ago

GeistFighter commented 2 years ago

Hey everyone,

Why i get "Error: Could not search on Google: Request failed with status code 429".

When i user the exemple code:

async function start() { const options = { page: 0, safe: false, // hide explicit results? additional_params: { // add additional parameters here, see https://moz.com/blog/the-ultimate-guide-to-the-google-search-parameters and https://www.seoquake.com/blog/google-search-param/ hl: 'en' } }

const response = await google.search("TWDG", options); console.log(response); }

start();

LuanRT commented 2 years ago

Hello, status code 429 means you are being rate-limited by Google. If this is the first time you're using the library and got that right away then I assume Google might be blocking your IP address for some reason (Eg: maybe your IP is shared), in that case switching to a different IP will most likely fix the problem.

GeistFighter commented 2 years ago

Hello, it's really strange, indeed it's the first time I use your package, nevertheless my IP is dedicated, it doesn't seem to be banned from google I can reach my website from google for example.

GeistFighter commented 2 years ago

You will have a manipulation to make to deepen the research of the "why"?

GeistFighter commented 2 years ago

I just tested with another package (not as well supplied as yours) but it works, so it must come from google-this.

GeistFighter commented 2 years ago

Now it works, I don't know why.

LuanRT commented 2 years ago

Now it works, I don't know why.

Hello, so I've done a little testing on some remote servers and it seems to work fine even after spamming requests to the Google website. I feel like Google might have temporarily blocked incoming requests from your server's IP, if that happens again you can either wait or just change your server's IP address if possible.

Edit: And apologies for the delayed response.

cdwmhcc commented 9 months ago

It keeps prompting 429, and changing the IP cannot solve it. Testing with curl is not affected and works fine.