Skip to content

Instantly share code, notes, and snippets.

@makotoworld
Created February 8, 2012 05:11
Show Gist options
  • Save makotoworld/1765616 to your computer and use it in GitHub Desktop.
Save makotoworld/1765616 to your computer and use it in GitHub Desktop.
YoutubeID Entry Details
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import gdata.youtube
import gdata.youtube.service
yt_service = gdata.youtube.service.YouTubeService()
entry = yt_service.GetYouTubeVideoEntry(video_id='3KjgpNdcudU')
def PrintEntryDetails(entry):
print 'Video title: %s' % entry.media.title.text
print 'Video published on: %s ' % entry.published.text
print 'Video description: %s' % entry.media.description.text
print 'Video category: %s' % entry.media.category[0].text
print 'Video tags: %s' % entry.media.keywords.text
print 'Video watch page: %s' % entry.media.player.url
print 'Video flash player URL: %s' % entry.GetSwfUrl()
print 'Video duration: %s' % entry.media.duration.seconds
# non entry.media attributes
print 'Video geo location: %s' % entry.geo.location()
print 'Video view count: %s' % entry.statistics.view_count
print 'Video rating: %s' % entry.rating.average
# show alternate formats
for alternate_format in entry.media.content:
if 'isDefault' not in alternate_format.extension_attributes:
print 'Alternate format: %s | url: %s ' % (alternate_format.type,
alternate_format.url)
# show thumbnails
for thumbnail in entry.media.thumbnail:
print 'Thumbnail url: %s' % thumbnail.url
PrintEntryDetails(entry)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment