Rails 7 #135 Export videos from ANY Youtube channel using Youtube API

12/06/2023 (11 months ago)
youtube api api ActiveJob Google Cloud Console YouTube Channel Videos List YouTube Channel Videos YouTube Data API v3 Ruby gem 'google-api-client' Generate YouTube API key YouTube Channel ID API call to show video details Import YouTube videos into Rails app Rails app with YouTube videos List and paginate YouTube videos Create YouTube video record Display YouTube videos in a view YouTube video integration

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