Skip to content

Instantly share code, notes, and snippets.

@sillygwailo
Created October 15, 2013 03:25
Show Gist options
  • Save sillygwailo/6986076 to your computer and use it in GitHub Desktop.
Save sillygwailo/6986076 to your computer and use it in GitHub Desktop.
YouTube
import cgi, urllib, urlparse, webbrowser, sys, clipboard, console
argLen = len(sys.argv)
if argLen > 1:
url = sys.argv[1]
else:
url = clipboard.get()
p = urlparse.urlparse(url)
subdomain = p.hostname.split('.')[0]
domain = p.hostname.split('.')[1]
if subdomain == 'm' and domain == 'youtube':
q = cgi.parse_qs(p[4])
webbrowser.open('safari-http://www.youtube.com/v/' + q['v'][0])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment