我正在使用googleapi软件包。
我想从youtube Analytics API中获取“ insightTrafficSourceDetail”。
这是我的代码:
google.youtubeAnalytics('v2').reports.query({
metrics: 'estimatedMinutesWatched,views',
dimensions: 'insightTrafficSourceDetail',
filter: 'video==[some_video_id];insightTrafficSourceType==YT_SEARCH',
startDate: '2019-01-01',
endDate: '2019-02-12',
ids: 'channel==MINE',
sort: '-estimatedMinutesWatched',
maxResults: 25,
});
这是我得到的答复:
code: 400,
errors:
[ { message:
'The query is not supported. Check the documentation at https://developers.google.com/youtube/analytics/v2/available_reports for a list of supported queries.',
domain: 'global',
reason: 'badRequest' } ] }
尽管在Google文档中,他们给出了与示例请求Top 10 – External websites that generate the most traffic for a video相同的请求
答案 0 :(得分:0)
google.youtubeAnalytics('v2').reports.query({
metrics: 'estimatedMinutesWatched,views',
dimensions: 'insightTrafficSourceDetail',
filter: 'video==[some_video_id];insightTrafficSourceType==YT_SEARCH',
startDate: '2019-01-01',
endDate: '2019-02-12',
ids: 'channel==MINE',
sort: '-estimatedMinutesWatched',
maxResults: 25,
});
在上面的代码中,应该是“过滤器”而不是“过滤器”。当我更换它时,它开始正常工作。
filters: 'video==[some_video_id];insightTrafficSourceType==YT_SEARCH',