The code I posted uses v1 of the API and still has that "hacky"
approach. That's just a limitation of the v1 response and the methods
that the Python client library exposes to access the parsed responses,
unfortunately.
Cheers,
-Jeff Posnick, YouTube API Team
~ YouTube is hiring! ~ http://google.com/jobs/workyoutube ~
On Apr 2, 3:14 am, Denzil Correa <mcen...@gmail.com> wrote:
> Hi Jeff,
>
> Thanks for the reply. I face a similar problem with v1 response too. I
> am okay with using the v1 response if it avoids the above "hack". I
> can access the ns:0 elements on the XML but I am not sure how to
> access ns:1 elements. Any help with that regard?
>
> On Apr 1, 11:07 pm, Jeffrey Posnick <je...@google.com> wrote:
>
>
>
>
>
>
>
> > Hello Denzil,
>
> > So you're requesting a YouTube API v2 response, but the Python client
> > library only supports v1. That might make deserialization a little
> > tricky.
>
> > In any case, this seems to work—you need to parse the playlist URL to
> > get back only the id portion, but the format of that URL is not going
> > to change and it's safe enough to do:
>
> > playlist_feed =
> > yt_service.GetYouTubePlaylistFeed(username='basit9008')
> > for playlist_entry in playlist_feed.entry:
> > print playlist_entry.id.text.split('/')[-1]
>
> > Cheers,
> > -Jeff Posnick, YouTube API Team
> > ~ YouTube is hiring! ~http://google.com/jobs/workyoutube~
>
> > On Mar 28, 6:46 pm, Denzil Correa <mcen...@gmail.com> wrote:
>
> > > Hi,
>
> > > I am accessing the following Playlist feed in Python :http://gdata.youtube.com/feeds/api/users/basit9008/playlists?v=2
>
> > > I receive the attached file as a playlist entry. I would like to retrieve
> > > the playlist ID. In particular the element,
>
> > > *<ns2:playlistId
> > > xmlns:ns2="http://gdata.youtube.com/schemas/2007">FB10EDCB378F825E</ns2:playlistId>
> > > *
> > > *
> > > *
> > > I can access the other entry elements by doing the following
>
> > > for playlist_entry in playlist_feed.entry:
>
> > > print playlist_entry.author[0].name.text
>
> > > I am using YouTube Python API.
>
> > > playlistfeed_entry.txt
> > > 1KViewDownload
--
You received this message because you are subscribed to the Google Groups "YouTube APIs Developer Forum" group.
To post to this group, send email to youtube-api-gdata@googlegroups.com.
To unsubscribe from this group, send email to youtube-api-gdata+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/youtube-api-gdata?hl=en.
No comments:
Post a Comment