Skip to content

Instantly share code, notes, and snippets.

@stefan2904
Created May 9, 2015 02:13
Show Gist options
  • Save stefan2904/bf0e0509ae7df9f0312e to your computer and use it in GitHub Desktop.
Save stefan2904/bf0e0509ae7df9f0312e to your computer and use it in GitHub Desktop.
Get the title of a YoutTube video by it's video ID
from urlparse import urlparse, parse_qs
import urllib2
videoid = "bMSTtWtzV-A"
response = urllib2.urlopen("http://youtube.com/get_video_info?video_id=" + videoid)
query = urlparse("/?" + response.read()).query
title = parse_qs(query)['title']
print title
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment