Search code examples
google-cloud-platformgoogle-bigqueryyoutubeyoutube-apiyoutube-data-api

YouTube API - Historical Video Views on Channel


I need to extract the activity on a company YouTube channel going back 5+ years. I ran into an issue with the YouTube Analytics API as it is limiting me to the last 30 days of activity. I am thinking of trying the YouTube Data API V3 next, but want to first ask here if anyone knows how to pull the deep historical data from a YouTube channel. I am interested primarily in the number of views per video per day. I am using Google Cloud Platform and need to store the data in BigQuery.

https://developers.google.com/youtube/analytics/reference

https://developers.google.com/youtube/v3/docs

Thanks,

Steve


Solution

  • Youtube Data API will only give you the current numbers from the channel/videos, not the historical data. For that you will need to use the Analytics API.

    In order to get the full data for each video you will need to hit the analytics reports query and use filters and parameters to get the data you need. Specifically for what you mentioned in the question, take a look in the startDate and endDate parameters and use the day dimension to aggregate the data. You will also need to use the videoId to filter the data (and to get a list of video_ids you can use the data API).

    I am currently getting data for the last 5+ years. Just an example here by getting 2017 information: Historical dates views