Skip to content

Instantly share code, notes, and snippets.

@scturtle
Created April 2, 2013 16:43
Show Gist options
  • Save scturtle/5293801 to your computer and use it in GitHub Desktop.
Save scturtle/5293801 to your computer and use it in GitHub Desktop.
play youku with MPlayerX.app
#!/usr/bin/env python
import re
import os
import sys
import urllib
if len(sys.argv) <= 1:
print 'Usage: {} [video | videourl]'.format(sys.argv[0])
sys.exit()
url = sys.argv[1]
if not url.startswith('http://'):
url = 'http://v.youku.com/v_show/id_{}.html'.format(url)
url = ('http://www.flvcd.com/parse.php?format=super&kw=' +
urllib.quote_plus(url))
html = urllib.urlopen(url).read().decode('gbk')
links = re.search(r'<input type="hidden" name="inf" value="([^"]+)"',
html).groups()[0].strip().split('\r\n')
for i, link in enumerate(links):
if raw_input('play part {} [y/n]? '.format(i+1)) == 'y':
os.system('open -a /Applications/MPlayerX.app --args -url ' + link)
@jProvim
Copy link

jProvim commented Nov 2, 2013

I have wrote an enhanced version which automatically quit MPlayerX when next clip plays, I want to make a pull request, but gist does not really support it. Please update it if you feel necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment