7

I'm using these apis https://developers.google.com/youtube/ and I can't figure out how, given a youtube channel address, get the video list with related infos (single video url and title, at least)

Phate
  • 6,066
  • 15
  • 73
  • 138
  • Perhaps [this](https://developers.google.com/youtube/code#Java) might be useful if you haven't seen before – Jacob Nov 04 '12 at 12:10
  • Having the same issue. I see a way to get this information for a list of given video IDs, but no way to retrieve the list of video IDs for a channel. – John Ledbetter Nov 07 '12 at 18:56

3 Answers3

7

I know this is no longer relevant, but for anyone here in 2020, youll need a youtube v3 api key

What you can use is

https://www.googleapis.com/youtube/v3/search?key=[API_KEY]&channelId=[CHANNEL_ID]&part=snippet,id&order=date&maxResults=50

you can remove snippet and it will not give the names and other information of all of the videos. ID gives the video id

send a get request to the URL

E962
  • 142
  • 1
  • 11
5

It's a bit convoluted, but can be done relatively painlessly. The trick is in knowing that a channel is really just a list of videos uploaded by a particular user. So if, when you say you have a youtube channel address, that address takes the form of:

http://www.youtube.com/user/[username]

Then you can get the videos with the user uploads feed:

https://gdata.youtube.com/feeds/api/users/[username]/uploads

As a side note, if you use the feed:

https://gdata.youtube.com/feeds/api/users/[username]

You'll get back extra info about the user, including a series of elements that give you various feed links (one of which is the uploads feed I mentioned above) that also contain info such as number of videos, etc.

If instead your channel URL is in the form:

https://www.youtube.com/channel/UC[userid]

Note that this kind of URL always starts with UC and then a long string. In this case, just drop the UC, and visit this feed:

https://gdata.youtube.com/feeds/api/users/[userid]/uploads
jlmcdonald
  • 13,408
  • 2
  • 54
  • 64
4

This method is especially useful if a) the channel has more than 50 videos or if b) desire youtube video ids formatted in a flat txt list:

  1. Obtain a Youtube API v3 key (see https://stackoverflow.com/a/65440324/2585501)
  2. Obtain the Youtube Channel ID of the channel (see https://stackoverflow.com/a/16326307/2585501)
  3. Obtain the Uploads Playlist ID of the channel: https://www.googleapis.com/youtube/v3/channels?id={channel Id}&key={API key}&part=contentDetails (based on https://www.youtube.com/watch?v=RjUlmco7v2M)
  4. Install youtube-dl (e.g. pip3 install --upgrade youtube-dl or sudo apt-get install youtube-dl)
  5. Download the Uploads Playlist using youtube-dl: youtube-dl -j --flat-playlist "https://<yourYoutubePlaylist>" | jq -r '.id' | sed 's_^_https://youtu.be/_' > videoList.txt (see https://superuser.com/questions/1341684/youtube-dl-how-download-only-the-playlist-not-the-files-therein)
user2585501
  • 596
  • 4
  • 17