如何过滤 YouTube Analytics API 仅请求嵌入式视频统计信息

How to filter YouTube Analytics API request for embedded video stats only

我正在尝试从 YouTube 分析工具 API 获取仅针对嵌入式视频的数据。

当我使用 "insightPlaybackLocationType==EMBEDDED" 过滤器时,我收到不支持该查询的响应。没有这个过滤器,查询 returns 没有任何错误的响应。

response = self.executeAPIRequest(
    yt_instance.reports().query,
    ids="channel==" + c_id,
    startDate=startdate,
    endDate=enddate,
metrics="views,likes,dislikes,comments,shares,estimatedMinutesWatched,averageViewDuration,averageViewPercentage",
    sort='-views',
    filters="video==VIDEO_ID_HERE;insightPlaybackLocationType==EMBEDDED",
    maxResults=200,
)

这是我得到的错误:

googleapiclient.errors.HttpError: https://youtubeanalytics.googleapis.com/v2/reports?ids=channel%3D%CHANNEL_ID_HERE&startDate=2017-02-28&endDate=2019-08- 11&metrics=views%2Clikes%2Cdislikes%2Ccomments%2Cshares%2CestimatedMinutesWatched%2CaverageViewDuration%2CaverageViewPercentage&sort=-views&filters=video%3D%VIDEO_ID_HERE%3BinsightPlaybackLocationType%3D%3DEMBEDDED&maxResults=200&alt=json返回"The query is not supported. Check the documentation at https://developers.google.com/youtube/analytics/v2/available_reports for a list of supported queries." >

该过滤器只能用于 insightPlaybackLocationDetail 维度。 请记住,该维度仅支持 viewsestimatedMinutesWatched 指标。

文档(播放位置详细信息): https://developers.google.com/youtube/analytics/channel_reports#playback-location-reports

请务必为此维度正确设置 sortmaxResults 参数。