google-trends - PyTrends 历史每小时数据

标签 google-trends

我对 Python 和一般编码很陌生。感谢您的耐心等待。

使用 PyTrends 我试图获取全年单个搜索词的 Google 趋势每小时结果。我看到 Python 软件基金会 (https://pypi.org/project/pytrends/) 声明“'现在 1-H'”“似乎只能工作 1、4 小时”。我尝试过一些人们试图获得自定义每小时搜索的例子,但没有一个对我有用。我想知道是否不再可以获得 Google 趋势历史每小时数据,而我应该停止查找?

最佳答案

也许已经有点晚了,但如果将来有人发现这个问题,您可以在 PyTrends 开发人员的 github 上找到如何获取历史每小时 Google 趋势数据的最新方法:

https://github.com/GeneralMills/pytrends#historical-hourly-interest

应用了相应功能的简短片段:

# Since pytrends is returning a DataFrame object, we need pandas:
import pandas as pd
# Import of pytrends (needs to be pip installed first):
from pytrends.request import TrendReq

pytrends = TrendReq(hl='en-US', tz=360)
kw_list = ['search_term_1', 'search_term_2']

search_df = pytrends.get_historical_interest(kw_list, year_start=2019,
                                             month_start=5, day_start=1,
                                             hour_start=0, year_end=2019,
                                             month_end=7, day_end=31, hour_end=0,
                                             cat=0, geo='', gprop='', sleep=60)

将相应的参数替换为所需的参数,然后就可以了 - 每小时的历史 Google 趋势数据。

希望对您有帮助! 最好的, 亚维兹

关于google-trends - PyTrends 历史每小时数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54100530/

相关文章:

javascript - 如何使用元音变音字符 ö ä ü 嵌入 Google 趋势

google-trends - 谷歌趋势 : Obtaining absolute values

java - 有没有很好的API来获取有关当前事件的信息?

python - 使用 selenium Python 检索 Google 趋势数据中的所有元素

google-trends - 自动从 Google Trends 中提取 csv 文件

python - 无需包装器或使用 API : Python 即可访问 Google 趋势数据

python - 趋势 : repeatedly running the same script gives results for different sets of countries

python - Pytrends - 响应错误 : The request failed: Google returned a response with code 400

python - Google 趋势爬虫代码 429 错误