GeneralMills / pytrends

Pseudo API for Google Trends
Other
3.23k stars 817 forks source link

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

Open Reynolddoss opened 1 year ago

Reynolddoss commented 1 year ago

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

ShannonWavelet commented 1 year ago

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

nicktba commented 1 year ago

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 1 year ago

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

image

https://8pf86r.csb.app/

nicktba commented 1 year ago

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 1 year ago

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

nicktba commented 1 year ago

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