Steve Albright
Steve Albright

Reputation: 3

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

Upvotes: 0

Views: 1284

Answers (2)

Benjamin Loison
Benjamin Loison

Reputation: 5612

As YouTube Data API v3 doesn't provide this basic feature, I would recommend you to try on your own to get the data your are looking for:

By requesting the YouTube studio Video analytics webpage of a video interesting you:

https://studio.youtube.com/video/VIDEO_ID/analytics

Below the Views chart, click on SEE MORE.

Then open your web browser Network tab (using Ctrl + Shift + E). Make sure to filter XHR requests.

Then select Since uploaded (lifetime) for the time range.

You should be able to see a request to join endpoint, copy it as cURL by right-clicking it.

To use this request for another given video, think about modifying the video id of the JSON --data-raw argument at /nodes/1/value/query/restricts/0/inValues and to also modify /nodes/1/value/query/timeRange/dateIdRange/inclusiveStart to the upload date of the video (retrievable with YouTube Data API v3) in the format yyyymmdd.

Upvotes: 0

Herivelton Andreassa
Herivelton Andreassa

Reputation: 426

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

Upvotes: 0

Related Questions