Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to retrieve all video URLs from a YouTube channel? json?

What would be the easiest way to compile a list of all the video URLs (preferably the shortened YuoTube ones) from a YouTube channel?

I need to retrieve all the URLs from this channel's uploads: https://www.youtube.com/user/TheLancetTV

Could this be done using YouTube API in combination with json? If so, how?

Thanks in advance Nicolai

like image 458
Nicolai Avatar asked Dec 11 '25 00:12

Nicolai


2 Answers

You can accomplish this using the YouTube Data API using two calls.

First, retrieve the playlists available on the channel with a call to Channels. For example:

GET https://www.googleapis.com/youtube/v3/channels?part=contentDetails&forUsername=TheLancetTV&key={YOUR_API_KEY}

This will get you the the related playlists with the uploads. You'll take this ID and make a call to PlaylistItems with this ID to retrieve the list of videos.

GET https://www.googleapis.com/youtube/v3/playlistItems?part=contentDetails&playlistId=UU0-vwPmp-nmu_Huza_nq0AA&key={YOUR_API_KEY}

This will get you the video IDs which you can then turn into URLs.

like image 93
JohnD Avatar answered Dec 13 '25 00:12

JohnD


UPDATE: This is no longer usable. Please use the Youtube API.

You can use the youtube Api for this purpose. Its a deprecated version, but you can still get the.

the request would be -

https://gdata.youtube.com/feeds/users/channel-id/uploads?&alt=json

Substitute the channel id for the one your prefer.

like image 40
Keval Doshi Avatar answered Dec 13 '25 00:12

Keval Doshi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!