This code uses YouTube's API to grab the latest 50 videos from any channel, to give you a Pandas DataFrame containing:
video_id
video_title
upload_date
view_count
like_count
comment_count
for the latest 50 videos.
Need to update the code so it fetches data for max_results
number of videos.
Great project to understand how API's work and how API Quota works.
Currently, the code only fetches the latest 50 videos leaving you with a DataFrame of no more than 50 videos for any Channel. Need to find a way to grab the nextPageToken
each time.
- For any YouTube channel, go to their landing page (like https://www.youtube.com/@MrBeast)
- Press CTRL + U for Windows which should take you to the page's source code
- CTRL + F for "?channel" which will take you to the
channel_id
- Plug it into the code where
CHANNEL_ID
is mentioned
- Refer to this super concise blog https://www.slickremix.com/docs/get-api-key-for-youtube/
- Get your
API_KEY
and plug it into the code where mentioned
- Short and sweet tutorial used for reference - by Strata Scratch, great data science resource
- List of Methods - to read up on the various channel properties that you can request for
- Quota Dashboard - to check how much quota you have remaining
- Quota Calculator - to know the cost of each method that you'll use
Plug in the CHANNEL_ID
and API_KEY
and the code is good to go :)
For reference, this what the DataFrame for Mr Beast's channel looks like: