【发布时间】:2018-05-29 09:04:19
【问题描述】:
我正在使用 Youtube Analytics API 运行以下查询
now = datetime.datetime.now()
start_date = (now - datetime.timedelta(days=4)).strftime('%Y-%m-%d')
end_date = (now - datetime.timedelta(days=3)).strftime('%Y-%m-%d')
args = {
'metrics': 'views,estimatedMinutesWatched',
'dimensions': 'subscribedStatus',
'ids': 'channel==<my_channel_id>',
'startDate': start_date,
'endDate': end_date
}
analytics_query_response = youtube.reports().query(**args).execute()
我正在使用 youtube analytics api 版本 2,并将 end_date 参数更改为 endDate 并将 start_date 更改为 startDate,我收到以下响应
{u'kind': u'youtubeAnalytics#resultTable', u'rows': [], u'columnHeaders': [{u'dataType': u'STRING', u'columnType': u'DIMENSION', u'name': u'subscribedStatus'}, {u'dataType': u'INTEGER', u'columnType': u'METRIC', u'name': u'views'}, {u'dataType': u'INTEGER', u'columnType': u'METRIC', u'name': u'estimatedMinutesWatched'}]}
我得到“行”作为响应,但它是空的。当我在 Youtube API Explorer 中尝试使用相同的参数时,它给了我“行”的结果。
我在这里做错了什么?
【问题讨论】:
标签: youtube youtube-analytics-api