嗨,我正在使用 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"
}
]
}
}
我不知道我是否拼写错误或有什么问题,但我检查了所有内容,结果是正确的。
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”才能使其工作。