Nicolai
Nicolai

Reputation: 31

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

Upvotes: 3

Views: 5830

Answers (2)

Keval Doshi
Keval Doshi

Reputation: 748

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.

Upvotes: 1

JohnD
JohnD

Reputation: 4002

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.

Upvotes: 1

Related Questions