Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it just me or have 429 errors really increase these past few days? #538

Closed
igalci opened this issue Oct 25, 2022 · 23 comments
Closed

Is it just me or have 429 errors really increase these past few days? #538

igalci opened this issue Oct 25, 2022 · 23 comments

Comments

@igalci
Copy link

igalci commented Oct 25, 2022

I used to get 429 error every time I request more than 6 items per hour or so.

But recently, especially today I am not able to request more than 1 per hour without getting 429. Is it just my IP acting up?

@edbarbier
Copy link

Experiencing the same issue with the node library from @pat310 lately.

@CharlesFr
Copy link

Any workarounds?

@ReemOmer
Copy link

Same! the only workaround I was able to do is to re-run the code multiple times in different machines or using colab with different account.

@firmai
Copy link

firmai commented Oct 28, 2022

Same here, they are locking down folks.

@royherma
Copy link

royherma commented Oct 29, 2022

How is there no reliable solution for this in 2022 😢 - was getting issues on pat's node js proj and was about to try this one, but then saw same thing happening

@emlazzarin
Copy link
Collaborator

emlazzarin commented Oct 29, 2022 via email

@Arsh1219
Copy link

Not facing the issue after using proxies and sleep 60 seconds after each request.

@CharlesFr
Copy link

Not facing the issue after using proxies and sleep 60 seconds after each request.

Do you mind sharing where you're getting proxy from and how you're implementing them?

@Arsh1219
Copy link

Not facing the issue after using proxies and sleep 60 seconds after each request.

Do you mind sharing where you're getting proxy from and how you're implementing them?

I’m using proxies from newipnow. I’m using 25 proxies and using random proxy on each request.

@ReemOmer
Copy link

ReemOmer commented Nov 1, 2022

Guys, I just figured that if you downgrade the pytrend library to 4.7.2 or 4.7.3 it works. Also, collecting data for different geographical locations may stop the process, use only one location at a time, with up to 5 keywords. For more than 5 keywords, you need to apply normalization, and that is by using one shared keyword as a control in all sets of 5 keywords.

@ReemOmer
Copy link

ReemOmer commented Nov 1, 2022

Alternatively, you may want to try R instead of Python: https://cran.r-project.org/web/packages/gtrendsR/gtrendsR.pdf
This is a recent release of this month; it is more recent and reliable to use.

@jhascall
Copy link

jhascall commented Nov 1, 2022

Guys, I just figured that if you downgrade the pytrend library to 4.7.2 or 4.7.3 it works. Also, collecting data for different geographical locations may stop the process, use only one location at a time, with up to 5 keywords. For more than 5 keywords, you need to apply normalization, and that is by using one shared keyword as a control in all sets of 5 keywords.

This worked for me! Thanks for the fix!

@emlazzarin
Copy link
Collaborator

emlazzarin commented Nov 1, 2022 via email

@jhascall
Copy link

jhascall commented Nov 1, 2022

Guys, I just figured that if you downgrade the pytrend library to 4.7.2 or 4.7.3 it works. Also, collecting data for different geographical locations may stop the process, use only one location at a time, with up to 5 keywords. For more than 5 keywords, you need to apply normalization, and that is by using one shared keyword as a control in all sets of 5 keywords.

This worked for me! Thanks for the fix!

Update: now it doesn't work... It only took 12 hours for them to block it

@ReemOmer
Copy link

ReemOmer commented Nov 3, 2022

It is still working for me! try to increase the sleep time between requests for each subset of keywords (I use random number between 5 and 30 seconds wait). Also, don't use only one machine with the same IP address, alternate between your machine and Google Colab.

@emlazzarin
Copy link
Collaborator

emlazzarin commented Nov 3, 2022 via email

@ReemOmer
Copy link

ReemOmer commented Nov 3, 2022

Both! I figured that even if I downgraded and sent too many requests, Google may block my IP, therefore, I had to change the IP this can be done by using proxies, vpn, Google Colab has also different range of IPs.

@emlazzarin
Copy link
Collaborator

emlazzarin commented Nov 3, 2022 via email

@igalci
Copy link
Author

igalci commented Nov 3, 2022

@ReemOmer I am curious, how do you use Google Colab to scrape? I don't believe they have an API... And I haven't found any guide like that....

@ReemOmer
Copy link

ReemOmer commented Nov 7, 2022

@emlazzarin honestly I didn't open any of the main files in both versions, so I don't know what the difference is.
@igalci I used the same way of running the code in Jupyter notebook or a regular Python file run using the cmd. You will still use the Pytrends library and call all its functions.

@regionalecon
Copy link

I have an extremely novice understanding of the inner-workings of the package, but could this problem have something to do with cookies expiring on the trends.google site? I previously have been able to workaround 429 errors with this solution but now that doesn't work either. Scrolling through the request headers, I noticed a cookie expiration time that ends in the same minute as submitting the request.

@xenova
Copy link
Contributor

xenova commented Dec 4, 2022

Looks like no user-agent is specified in the requests, meaning they are blocked more often. I fixed it here: 18f230d

emlazzarin added a commit that referenced this issue Dec 26, 2022
Fix 429 errors (Fixes #354, #413, #492, #523, #535, #538) and fix pandas `frame.append` deprecation warning (Fixes #525)
@emlazzarin
Copy link
Collaborator

Fixed by #553.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests