🚨 Pay Just $95/Year (Save 50%)β€”Black Friday Deal!

#135 Export videos from ANY Youtube channel using Youtube API

12/06/2023
youtube api api ActiveJob Google Cloud Console YouTube Data API v3

How to Get List of YouTube Channel Videos using YouTube API?

I’ve got 150+ videos on @SupeRails Youtube channel, and now I want to list them on my own superails.com website.

I could copypaste the information manually, but that would take ages.

I could use web scraping, but what's the point, if there is an easy to use Youtube API?

In this episode we will:
βœ… Learn basics of using Google Cloud Console ☁️
βœ… Enable and use Youtube API
βœ… LIST videos from ANY channel
βœ… Get detailed info for any particular video
βœ… Paginate API results
βœ… Store results in our local database πŸ’Ύ
βœ… Use ActiveJob to do it all async

Episode source code: https://github.com/corsego/135-youtube-api/commit/8f5d71f1b3b52624c1c4986ab045a1b96ce15347
Based on this blogpost: https://blog.corsego.com/youtube-api

0:00 How to extract videos from Youtube?
1:20 Enable Youtube Data API in Google Cloud
2:03 Create API key
2:20 Install Google API Ruby Client gem for Youtube
5:45 Make API request to Youtube to LIST videos
7:25 Make API request to SHOW one video
8:50 Get video Duration
10:35 Save API data in Rails database
12:30 Create ActiveJob to LIST videos
18:44 Create ActiveJob to get each video and save in the database
28:17 Schedule video creation jobs inside video list job
29:35 Run the import job!
30:56 Final result! Let's look at the imported data

0
Sign in to join the conversation