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

new version of google trends not compatible whit pytrend 4.9.0 #566

Closed
ithabibi opened this issue Mar 18, 2023 · 6 comments · Fixed by #570
Closed

new version of google trends not compatible whit pytrend 4.9.0 #566

ithabibi opened this issue Mar 18, 2023 · 6 comments · Fixed by #570

Comments

@ithabibi
Copy link

ithabibi commented Mar 18, 2023

hi dear Eddy Lazzarin
In recent days, Google Trends has made changes in its service.
I think that the new version of google trends is not compatible with Pytrends 4.9.0
Please check the issue.
for more information, I added python stack trace of error.
Capture

best regards
ithabibi

@ozfrenz
Copy link

ozfrenz commented Mar 18, 2023

Same for me
158 if response.status_code == status_codes.codes.too_many_requests:
159 raise exceptions.TooManyRequestsError.from_response(response)
--> 160 raise exceptions.ResponseError.from_response(response)

ResponseError: The request failed: Google returned a response with code 400

I tried user_agent, proxy and vpn as well. Also changed to "GET" to "POST" in @jesvinc #561 (comment)

still no luck.

I was using multinterest like the example below

pytrends.build_payload(kw_list=['pizza', 'bagel'], timeframe=['2022-09-04 2022-09-10', '2022-09-18 2022-09-24']))
pytrends.multirange_interest_over_time()

Thanks for all efforts

@karam-khanna
Copy link

Same as above

@totencrab
Copy link

totencrab commented Mar 19, 2023

The solution posted by @ckosmic here works consistently for me.

In the pytrends request.py file, at line 76 and 89, insert explore before /?geo.

so f'{BASE_TRENDS_URL}?geo={self.hl[-2:]}', becomes so f'{BASE_TRENDS_URL}explore/?geo={self.hl[-2:]}',

@megaluck
Copy link

I´ve did what totencrab suggested Now I get a 400 error

raise exceptions.ResponseError.from_response(response)

pytrends.exceptions.ResponseError: The request failed: Google returned a response with code 400

@totencrab
Copy link

totencrab commented Mar 20, 2023

I´ve did what totencrab suggested Now I get a 400 error

raise exceptions.ResponseError.from_response(response)

pytrends.exceptions.ResponseError: The request failed: Google returned a response with code 400

Sorry mate, I'm not sure why it's not working 🤷‍♂️

This is a copy of my pytrends.py if you wanted to have a closer look.

@ithabibi ithabibi changed the title new version of google trends not compatible whit pytrend new version of google trends not compatible whit pytrend 4.9.0 Mar 25, 2023
@ithabibi
Copy link
Author

hi dear Eddy Lazzarin In recent days, Google Trends has made changes in its service. I think that the new version of google trends is not compatible with Pytrends 4.9.0 Please check the issue. for more information, I added python stack trace of error. Capture

best regards ithabibi

Terseus added a commit to Terseus/pytrends that referenced this issue Mar 26, 2023
Google Trends slightly changed its HTTP requests calls:

- the "get cookie" request changed its URL, needed now an extra
  "explore/"; this was the main reason of the premature 429 error
  responses.
- the "widgets" request is now POST instead of GET.

Before this change the requests returned almost consistently 429 error
responses, now it returns results again.

Fixes GeneralMills#566, GeneralMills#567, GeneralMills#561
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

Successfully merging a pull request may close this issue.

5 participants