【问题标题】:Google Trends API - data frequencyGoogle Trends API - 数据频率
【发布时间】:2018-09-12 20:06:01
【问题描述】:

我已获得对 Google Trends API 的访问权限,并尝试使用入门指南的代码下载一些趋势数据:

start_date = ​'2010-01'
end_date = ​'2018-01'
response = service.getGraph(terms=​'apple'​,restrictions_startDate=start_date,restrictions_endDate=end_date).execute()
pprint.pprint(response)

这将返回每月数据。有没有办法以每日频率获取数据?

【问题讨论】:

    标签: google-apis-explorer google-trends


    【解决方案1】:

    Google Trends API 数据频率目前包括每周和每月频率,国家趋势订阅

    Currently Weekly 是 Google Trends API 接受的最短时间,但未来可能会适用于每日时间尺度频率。

    【讨论】:

      【解决方案2】:

      尝试使用更短的时间段来获得每周或每天的解决方案。

      【讨论】:

        【解决方案3】:

        getGraph 仅按周返回结果。要按天获取结果,请改用getTimelinesForHealth 并添加参数timelineResolution = 'day',如下所示:

        response = service.getTimelinesForHealth(
            terms = ​'apple'​,
            time_startDate = 'YYYY-MM-DD',
            time_endDate = 'YYYY-MM-DD',
            timelineResolution = 'day'
        ).execute()
        

        注意restrictions_startDaterestrictions_endDate 应该是 分别改为time_startDatetime_endDate,时间 以'YYYY-MM-DD'的格式表示。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2011-05-30
          • 1970-01-01
          相关资源
          最近更新 更多