google-it icon indicating copy to clipboard operation
google-it copied to clipboard

Error in response: statusCode 429

Open Rachniotov opened this issue 3 years ago • 8 comments

Version of google-it 1.6.1

Versions of npm and node npm - 6.14.6 node - v12.18.4

Describe the bug I was using this module in a NodeJS project (discord.js specifically) and I faced this error: Error in response: statusCode 429. To see the raw response object, please include the 'diagnostics: true' as part of the options object (or -d if using command line)

Expected behavior It should have given me results according to the query specified but it didn't.

Additional context I also enabled the "diagnostics" to see the raw data but it didn't gave me anything. Hope this info is alright for the info.

Rachniotov avatar Feb 06 '21 13:02 Rachniotov

Hi @Rachniotov, the 429 status code represents Too Many Requests. Do you happen to remember if you saw that error after creating a lot of searches within a limited span of time? This is something I haven't experimented with yet, but possibly one way to enhance this library to avoid seeing that error can be to use a different default user agent whenever encountering that 429 status code response. As an attempt to mimic a different user and hopefully bypass Google's bot detection.

PatNeedham avatar Feb 08 '21 04:02 PatNeedham

Ah I see, I'll limit the requests for now. Also when I tested it now, it sends the data in French, any way to fix it? or I just use proxy? Thanks for the help and a great package!!

Rachniotov avatar Feb 08 '21 13:02 Rachniotov

Sorry for the delayed response again. Not sure why the data is coming back in French - do you happen to be in a French-speaking country, or are you using google-it on a remote machine that is located in a French-speaking country? Honestly not sure what effect the proxy option might have.

PatNeedham avatar Feb 11 '21 03:02 PatNeedham

Yes I use a vps but I don't know the country. I am not sure what a proxy does, was just asking for help.

Rachniotov avatar Feb 21 '21 14:02 Rachniotov

I encountered that same issue and solved it by adding the parameter 'gl' to the search. You can see how that parameter works here

thatsthat avatar Feb 26 '21 10:02 thatsthat

I am seeing this issue on my first ever request with this package. It appears to run fine when run locally however when I run on a raspberry Pi it always gives this error. (Even if I haven't made a request with it for months!) Is there an issue with the OS used (as it does seem to have an effect)

InanisOmnia avatar Aug 05 '21 23:08 InanisOmnia

after some struggle with the similar issue I have created an API server based on a fork of this library and published it to RapidAPI: https://rapidapi.com/restyler/api/google-search26 - it has some additional logic to try to extract time snippet to separate json field.

restyler avatar Oct 30 '21 18:10 restyler