Elections DATA ACCESS SERVICES Toolkit
1
why monitor
social media
Effects of Manipulation Manipulation Around the Clock How Manipulators Work What Research Can be Done
2
getting started in
your own context
3
build your own
methodology
4
how you can
access data
5
Tools and
Techniques
6
make an
impact

YouTube

How can you access data?

YouTube data is available via the YouTube Analytics and Reporting API v.3. The process to access YouTube data is by far one of the easiest, but programming skills are required.

First, you will need to generate your API key to access data from within Python, R or your programming language of choice:

1. Login to your Google Account

2. Go to the Google Developers API Console page

3. Click on "+Enable APIs and Services"

4. Search and select the YouTube Data API v.3. Click to enable the API.

5. Go back to the homepage of your project by clicking the Google API logo at the top left. Then, click on the "Credentials" tab on the left side of the page.

6. Click on the blue "create credentials" button then select "API key". This will generate a YouTube API key, which you will need before creating your Oauth 2.0 client ID.

7. Next, click on the blue "create credentials" button again but this time select "OAuth client ID".

8. Complete the application page by selecting "other", adding a name and clicking "Create".

Congrats! You have generated your OAuth 2.0 client ID. You can always see it again by clicking the edit button on the credentials page. Since you are not requesting any user data, you will not need to complete the OAuth consent screen to submit further information to Google.


Now you have the information that you need to start calling the API from your programming language of choice. How do you get started with this?

9. YouTube has extensive documentation on how to pull data using the API along with a code generator to help you along the way. These resources are available for Python, Java and a number of other programming languages. For R users, you can try the tuber package.

In the future, DRI will try to upload sample code from our own analyses to help you get started with this step, so stay tuned!

What data is available?

Before going through all the steps to access YouTube data, what will you actually get?

You can search for collection of videos, channel and playlists that match the query parameters that you specify (e.g. keyword, location, etc). Based on this search, you can get number of metrics. YouTube provides an full description of what's available, here.

In more simple terms, you can get stats on on a specific videos including:

view countlike countdislike count
favorite countcomment countvideo category
video tagsvideo descriptionvideo title

You can also find out more about a specific channel including: 

channel titlenumber of viewnumber of subscribers
number of videoschannel descriptioncountry
view countcomment countsubscriber count
video count

Select another platform

Facebook Instagram Twitter WhatsApp
go to next chapter
With Contributions by Sponsored by Created By Contact us
Thank you for using the Digital Democracy Monitor Toolkit.
Please send us a message with any questions or feedback

Send

Thank you!
Your message has been successfully sent. We will contact you very soon!
Sorry, your message was not sent.
Please try again.