如何在youtube api上获得AVERAGE VIEW DURATION
答案 0 :(得分:1)
从YouTube Analytics API' s Sample Application
略微修改var request = gapi.client.youtubeAnalytics.reports.query({
// The start-date and end-date parameters must be YYYY-MM-DD strings.
'start-date': formatDateString(lastMonth),
'end-date': formatDateString(today),
// At this time, you need to explicitly specify channel==channelId.
// See https://developers.google.com/youtube/analytics/v1/#ids
ids: 'channel==' + channelId,
dimensions: 'day',
sort: 'day',
// See https://developers.google.com/youtube/analytics/v1/available_reports
// for details about the different filters and metrics you can request
// if the "dimensions" parameter value is "day".
metrics: 'averageViewDuration',
filters: 'video==' + videoId
});
当然,这假设您已经完成了验证和检索videoid的工作。