Youtube API for Python: How to Create a Unique Data Portfolio Project

preview_player
Показать описание

What's up, everyone! Data APIs are a great source of data for data science. In this video, I'm walking you step by step through the process of retrieving video data and channel data using Youtube Data API. All source code is provided in the accompanied Git repo below. Let me know if you found this video helpful :). Thank you for watching! :)

⚡️Link to Git repo for this portfolio project:
================================
(💬 I forgot to mention in the video: PLEASE remove your API key in your code before pushing the project to Github, to avoid people using your API key without your consent. Also, please don't use my API key 😉 😂).

👩🏻‍💻 COURSES & RESOURCES
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀

🙋🏻‍♀️ LET'S CONNECT!
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀

As a member of the Amazon and Coursera Affiliate Programs, I earn a commission from qualifying purchases on the links above. By using the links you help support this channel at no cost for you.

🔑 TIMESTAMPS
================================
0:00 - Intro
0:22 - Initialize project
1:16 - Obtain API key and
4:45 - Get channel statistics
9:10 - Get video IDs
11:36 - Get video statistics
13:15 - Bonus - Get comments on videos
13:36 - Data preprocessing
16:38 - Exploratory data analysis
20:12 - Final touch & cleaning up
20:53 - Push project to Github
22:03 - Outro

#ThuVu #Datanerd #DataAnalysis #CoffeeData #DataScience #dataanalytics
Рекомендации по теме
Комментарии
Автор

Hope you enjoyed this video! I forgot to mention one thing important, please remove your API key in the notebook before you post your project to Github. This is to prevent other people from using your API keys without your consent 🙂

Thuvu
Автор

For anyone that got an error at the 11:30 mark, this is the solution i used

The issue in the code is that the while loop that is intended to fetch additional pages of playlist items is not using the next_page_token to request the next page. Instead, it is making the same request repeatedly without updating the pageToken parameter. This leads to an infinite loop, as it keeps fetching the same page repeatedly.

Here's the corrected version of the code:

playlist_id = 'UUMki_UkHb4qSc0qyEcOHHJw'

def get_video_ids(youtube, playlist_id):

video_ids = []

request =
part="snippet, contentDetails",
playlistId=playlist_id,
maxResults=50
)
response = request.execute()

for item in response['items']:


next_page_token =
while next_page_token is not None:
request =
part="snippet, contentDetails",
playlistId=playlist_id,
maxResults=50,
pageToken=next_page_token # Add pageToken to request the next page
)
response = request.execute()

for item in response['items']:


next_page_token =

return video_ids
In this corrected version, the pageToken=next_page_token parameter is added to the subsequent requests inside the while loop. This ensures that each iteration of the loop fetches the next page of playlist items instead of repeating the same request.

k_celebs__
Автор

Please add more of this kind of projects, your way of explanation, information gathering is simply superb where we won't be able to find from others instructors and YouTube videos

jeevankumarthadikonda
Автор

For anyone that got an error at the 15:58 mark, this is the solution I used

The apply function in the second line is correctly using the isodate.parse_duration function to convert the duration string to a timedelta object. However, when you try to convert the resulting timedelta object to seconds using astype('timedelta64[s]'), it won't work as expected.
You should modify the code as follows:

# convert duration to seconds
import isodate
video_df['durationSecs'] = x:

In this modification, the total_seconds() method is used to convert the timedelta object to the total duration in seconds. This should give you the correct result for the video durations in seconds.

k_celebs__
Автор

Finally done with my project. I learned so much. Rewatched this video many times.

It's true that you learn by doing and not just by watching.

Thank you so much.

KaraboMoremi
Автор

i can't stress how thankful I am to have found your channel! You Explained everything so well!❤❤

doodlelifebyTammy
Автор

I've been having an issue with this video. Because I'm trying to give millions of likes, but it allows me one like (that's absurd)!!!! It's a shame because your content deserves a lot of love. Thank you for your dedication!

konradnoises
Автор

i've just started work on my github profile to be a data scientist, this project gonna be a great project idea

edudc
Автор

this video helped so much! honestly the analytic skills i learned through this video is way more helpful than a whole semester of my python course at uni. thanks a lot!!

jeeyuuni
Автор

This is exactly how this kind videos are supposed to be.🎉

MM-jrsr
Автор

Thanks for this video! Your content is well-explained & I like that you talk through your process as you go along.

I haven’t worked with API keys yet, but look forward to doing a project similar to this one some time.

kylajuett-she-ella
Автор

WooooW, great effort, Thank you so much, All the best and waiting for more videos

mahmoudkhattab
Автор

This was my first proper data science project, and I absolutely loved every minute of making this! Thank you so much!

sahanaramachandran
Автор

Great repository you made. Excellent job.💫

zahraBatenin
Автор

If you get an error at 15:20...that's because we need to import parse library..

here is the code:

from dateutil import parser

shanthankasula
Автор

Your channel is obviously going to be big, only 800+ subscribers right now but the quality is clear. Thanks for the video.

BGODE
Автор

This video was recommend to me out of the blue, and I am really glad it did! Really enjoyed it, thank you!

jeo
Автор

That's great, your style and speed is perfect for me. I will be looking at more. And I did sub.

Rama_Guru
Автор

Love the details in the video Thu, Thanks

TheMISBlog
Автор

Thanks for this incredible video, I have learned a lot while following these steps.
Hope you all well and look forward for upcoming videos, cheers!

have
join shbcf.ru