admin管理员组

文章数量:1125941

I'm using the pytrends library to fetch real-time trending searches from Google Trends, specifically for Mexico (pn='MX'). The same code used to work previously, but now it always returns an empty object. I couldn't find any recent updates to the library or its documentation that address this issue.

I checked the official pytrends PyPI page, and it seems the library hasn't been updated since April 2023. Has Google changed the endpoint or structure for fetching real-time trends, making this functionality in pytrends outdated? Should I consider alternative libraries or APIs for accessing Google Trends data, and if so, which ones are recommended?

Here is the code I'm using:

from pytrends.request import TrendReq

# Initialize pytrends
pytrend = TrendReq(hl='es-MX')

# Fetch real-time trending searches for Mexico
trends = pytrend.realtime_trending_searches(pn='MX')

print(trends)

The output I get is:

Empty 

本文标签: pythonWhy does pytrends39 realtimetrendingsearches return an empty objectStack Overflow