How to use Youtube API to extract YT channel data with Python (Step by step)

Опубликовано: 30 Октябрь 2022
на канале: Data Science Garage
9k
172

This video tutorial shows how to extract statistical data from a Youtube channel by using Youtube API provided by Google in a Python code.
You can get statistical data from any Youtube channel which has an unique username or ID by using Youtube Data API v3, which provides wide capabilities to get such statistics and channel’s metadata as:
- View Counts.
- Video Counts.
- Subscribers Count.
- Hidden Subscribers Count.

The video is divided into 4 main parts: firstly I will demonstrate how to setup Google Cloud Console for the API; then we will quickly run through the documentation and resources; then we will be ready to start some hands-on in Jupyter Notebook where we will write some simple lines of Python code; and finally we will come back to GCP and check the Youtube API Dashboard to monitor its data.

In the hands-on part we will import Google API Client, then declare our connection to the API with generated API key. Then we will write our first request to the API, execute it and print the response directly from Youtube API for a given channel.

The content of the tutorial is:
0:00-0:57 : Intro
0:57-3:10 : Setup Youtube API in Google Cloud Console
3:10-3:52 : Install Google API Client for Python
3:52-5:08 : API Documentation
5:08-11:17 : Hands-on with Jupyter Notebook (Python)
11:17 : Monitor data with Youtube API Dashboard in GCP

To get statistics from youtube channels we will use the Youtube Data API v3. This is an API that provides access to Youtube data, such as videos, playlists, and channels.
Also, in Python environment, we will install official Google API for Python library which supports requests to the API and returns responses. I did not check if the API supports Youtube Shorts which are trending today, but if I test it - I will surely share it with you.

Resources mentioned in the video:
- Google API Client for Python (Installation):
- Youtube API samples (incl. Youtube Data Analytics, Youtube Live Streaming API) in Python programming language:
- Google Developers documentation for Youtube Data API v3:

Specifically, we will use forUsername parameter to identify an Youtube channel in our requests declared in Python code. This approach valid if there is only one YT channel assigned to that user name. Also, there are other ways hot you can filter channels for your requests, you can check it here:

Subscribe the Data Science Garage channel to get upcoming videos first!

I hope this video and material was useful for you. Thank you for watching!
Your -


Смотрите видео How to use Youtube API to extract YT channel data with Python (Step by step) онлайн без регистрации, длительностью 12 минут 27 секунд в хорошем hd качестве. Это видео добавил пользователь Data Science Garage 30 Октябрь 2022, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 9 тысяч раз и оно понравилось 17 людям.