I'm trying to get total views of each channel owned by a content owner.
I could get total views of all channels, but I want to get each channel's views.
The following is the code I tried.
I set a dimensions=channel
to do it, but it returned a 400 error.
from googleapiclient.discovery import build
analytics_service = build("youtubeAnalytics", "v2", credentials=credentials)
report_result = analytics_service.reports().query(
ids= f'contentOwner=={owner_id}',
startDate='2020-12-01',
endDate='2021-03-30',
dimensions='channel', # <-- It raise the error.
metrics='views,comments,likes,dislikes',
filters='uploaderType==self',
).execute()
Error:
HttpError: <HttpError 400 when requesting https://youtubeanalytics.googleapis.com/v2/reports?ids=contentOwner%3D%3DkNuvRJ6GzXE5GEKbcUp7MA&startDate=2020-12-01&endDate=2021-03-30&dimensions=channel&metrics=views%2Ccomments%2Clikes%2Cdislikes&filters=uploaderType%3D%3Dself&maxResults=10&sort=-views&alt=json returned "The query is not supported. Check the documentation at https://developers.google.com/youtube/analytics/v2/available_reports for a list of supported queries.". Details: "The query is not supported. Check the documentation at https://developers.google.com/youtube/analytics/v2/available_reports for a list of supported queries.">
I checked docs of API, but I couldn't find a way to get it.
Please tell me if you know any good ways to do this.
Thanks.