javayoutube-apiyoutube-channels

Get list of video from a youtube channel


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)


Solution

  • 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