Youtube Analytics API:按城市提取用户活动但出现错误

问题描述 投票:0回答:1

嗨,我正在使用 google api 按城市提取用户活动。我关注了 youtube 文档 按城市划分的用户活动

request = youtube_analytics.reports().query(
        dimensions="city",
        endDate="2024-08-31",
        ids="channel==MINE",
        maxResults=25,
        metrics="views",
        sort="views",
        startDate="2024-08-01"
    )
    response = request.execute()

但是我收到了这个错误:

{
  "error": {
    "code": 400,
    "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.",
    "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-api youtube-analytics-api
1个回答
0
投票
request = youtube_analytics.reports().query(
        dimensions="city",
        endDate="2024-08-31",
        ids="channel==MINE",
        maxResults=25,
        metrics="views",
        sort="-views",
        startDate="2024-08-01"
    )
    response = request.execute()

显然,我需要在排序时拼写“-views”才能使其工作。

© www.soinside.com 2019 - 2024. All rights reserved.