Search code examples
pythonyoutubegdataplaylist

is there a way to get the YouTubeVideoEntry from a YouTubePlayListVideoEntry in the python gdata youtube client?


is there a way to get the YouTubeVideoEntry from a YouTubePlayListVideoEntry in the python gdata client?

I need to have the GetSwfUrl on the video, but this is only available on the YouTubeVideo entry object.


Solution

  • You have to make an additional request against YouTube's API in order to get the SWFUrl

    This example code will get print the SWFUrl for the first video in the playlist E6DE6EC9A373AF57

    playlist_feed = api.GetYouTubePlaylistFeed('http://gdata.youtube.com/feeds/api/playlists/E6DE6EC9A373AF57')
    first_video = playlist_feed.entry[0]
    entry_uri = [l.href for l in first_video.link if l.rel == 'related'][0]
    video_entry = api.GetYouTubeVideoEntry(entry_uri)
    print video_entry.GetSwfUrl()
    

    prints

    http://www.youtube.com/v/ADos_xW4_J0?version=3&f=videos&c=myid&d=AZI70qgwnzygE0LbSLCTnAwO88HsQjpE1a8d1GxQnGDm&app=youtube_gdata