Hi
I am trying to fetch monthly reports for views and estimated streaming minutes from my YouTube channel using the YouTube Analytics API at the video or playlist level. However, I am encountering an issue when specifying dimensions='playlist'.
Code Snippet:
SCOPES = [
'https://www.googleapis.com/auth/yt-analytics.readonly',
'https://www.googleapis.com/auth/youtube.readonly',
'https://www.googleapis.com/auth/youtube'
]
API_SERVICE_NAME = 'youtubeAnalytics'
API_VERSION = 'v2'
CLIENT_SECRETS_FILE = 'credentials.json'
execute_api_request(
youtubeAnalytics.reports().query,
ids='channel==MINE',
startDate='2024-01-01',
endDate='2024-12-01',
dimensions='playlist,month',
metrics='estimatedMinutesWatched,views,likes'
)
Issue:
HttpError 400 when requesting https://youtubeanalytics.googleapis.com/v2/reports?ids=channel%3D%3DMINE&startDate=2023-01-01&endDat... 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: "[{'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'}]"
What I Tried:
Question:
How can I fetch video or playlist-level analytics using the API without encountering this error? Is there an alternative approach or a workaround to retrieve this data?
Thank you in advance for your help!