GeneralMills/pytrends

Returns all data as zero when timeframe set to today 5-y

Reynolddoss opened this issue · 6 comments

Data gets retrieved but the values of all weeks seem to be zero.

from pytrends.request import TrendReq
pytrends = TrendReq(hl='en-US', tz=360)
pytrends.build_payload(["Real Madrid CF"], cat=0, timeframe='today 5-y', geo='', gprop='')
df = pytrends.interest_over_time()

image

Also having the same issue with a lot of consecutive zero values in the dataset downloaded

This is a known issue.

The problem is when the Google Trends API is requested it's flagged as USER_TYPE_SCRAPER and returns data with 0s.

The issue is on Google's side, it's even affecting the embedding feature as you can see. This is because the embedding feature also makes a request to the Google Trends API.

Screenshot 2023-07-20 at 11 14 30 AM

All other SERP products are facing this issue and a solution is not known.

When this happened last time, it persisted for a few weeks and then resolved itself. So that's what we can hope for.

Raidus commented

@nicktba tested out the embeddings approach too. its often not even loading for me.

image

https://8pf86r.csb.app/

Yep, check your network headers, you'll see its a 429 error blocking the request.

You'll also see USER_TYPE_SCRAPER In those headers.

That's because nearly all requests to the Google Trends API is being blocked, including the native embedding feature.

That's how we know its an internal issue and there is little we can do as of now.

Raidus commented

Looks like it's been resolved by Google. I get again normal data points and no errors. Also Iframes work again.

Update: Experiencing the issue again

Looks like it's been resolved by Google. I get again normal data points and no errors. Also Iframes work again.

Update: Experiencing the issue again

It seems like I'm getting somewhat better success, but the issue not fixed by any means