In the past few days, I’ve been working on retrieving data from various Google Products with their APIs, I figured it would be helpful (at least for myself!) to write a few short tutorials about them.
For a start, I would do it for Youtube Analytics API since it seems to be commonly used these days.
Prerequisites: You will need python 2.7 and a few libraries:
Authentication and Details: Below are a few steps you need to do beforehands:
- Create new Google project at google’s developers console
- Enable Youtube APIs at the
APIs & auth > APIs
tab:
- Generate your OAuth’s
client_secret.json
credentials at theAPIs & auth > Credentials
tab:
(Click Download JSON
after done)
- Get your
content_owner_id
andchannel_id
of choice at your Youtube’s dashboard (content_owner_id
will be displayed in the url - in this case:thIsiSaSampLeContentOwnErID
):
Firing your first ever API call (and also, generate your oauth2
credential file i.e youtubeAnalytics.dat
):
- In other to do this, we will use my version of Youtube API Sample file:
-
It’s also adviseable that you have a look at Youtube Channel Reports API Page or Youtube Content Owner Reports API Page for the list of
Metrics
,Dimensions
, andFilters
to be used in your own reports. -
Sample result: