5

I used to use the RSS feed to obtain videos from a user. I then used the "description" part of the feed, which contained a nicely HTML-formatted summary of a video. It shows a thumbnail with a link, time of video, username, star rating, etc.

Example:

http://gdata.youtube.com/feeds/base/users/KeepWatchingTheSkies/uploads?alt=rss&v=2&orderby=published&client=ytapi-youtube-profile (Search for second tag)

Now I'm trying to use the YouTube API (through the gdata Python interface,) and I'm able to retrieve the video entries, but I can't figure out how to get this "description" that I used to get through the RSS feeds.

How can I do this?

  • I found a workaround, I'm not interested in an answer for this question anymore, thanks. – Ram Rachum Nov 25 '10 at 14:16
  • 7
    It would have been nice to have you post your work around instead of running off rudely – Eight Days of Malaise Feb 26 '11 at 2:52
3
import gdata.youtube
import gdata.alt.appengine
import gdata.youtube.service

class Index(webapp.RequestHandler):
    def get(self):
        client = gdata.youtube.service.YouTubeService()
        feed = client.GetRecentlyFeaturedVideoFeed()
        gdata.alt.appengine.run_on_appengine(client)

        self.response.out.write('<html><body>')
        for entry in feed.entry:
            self.response.out.write('<div>%s</div>' %entry.media.description)
        self.response.out.write('</html></body>')

If you are using a rendering template like Django, instead of self response call the rendering function of the template and pass the variable feed, in your html file call Django variables like this:

replace the self.response with:

templates.render(self, 'home.html',
                    feed=feed,
                 )

and add to your html:

{% for entry in feed.entry %}
    <div>{{entry.media.description}}</div>
{% endfor %}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.