I'm using "v1" of the "youtubeAnalytics" service to get view counts for YouTube videos. I can get view data for a specific video by using "filters" parameter, but I'm not sure how to get data for multiple videos in one call. Here's what I'm currently doing to get views for one video:
YOUTUBE_ANALYTICS_API_SERVICE_NAME = "youtubeAnalytics"
YOUTUBE_ANALYTICS_API_VERSION = "v1"
youtube_id = item.get_youtube_id()
youtube_analytics = get_yt_service(credential, YOUTUBE_ANALYTICS_API_SERVICE_NAME, YOUTUBE_ANALYTICS_API_VERSION)
result = youtube_analytics.reports().query(ids="channel=={0}".format(get_username(credential)),
metrics="views",
dimensions='day',
filters='video=={0}'.format(youtube_id),
start_date=start_date,
end_date=end_date,
sort='-views'
).execute()
To be clear, I'm using the Google API client and "get_yt_service" is a wrapper for the build function:
from apiclient.discovery import build