Youtube 分析 api 给出 'Code:400 The query is not supported.' 错误

Youtube analytics api giving 'Code:400 The query is not supported.' error

我正在使用 googleapi 包。

我想从 youtube 分析中获取 'insightTrafficSourceDetail' API。

这是我的代码:

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

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'而不是'filter'。当我更换它时,它开始正常工作。

filters: 'video==[some_video_id];insightTrafficSourceType==YT_SEARCH',