Created
March 13, 2013 02:01
-
-
Save shelbyKiraM/5148811 to your computer and use it in GitHub Desktop.
A simple python script that tries to launch a twitch livestream
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/local/bin/python | |
| import sys | |
| import json | |
| import urllib2 | |
| import subprocess as sub | |
| username = "zerotri" if len(sys.argv) < 1 else sys.argv[1] | |
| mplayer = "/usr/local/bin/mplayer2" | |
| rtmpdump = "/usr/local/bin/rtmpdump" | |
| f = urllib2.urlopen("http://usher.twitch.tv/find/" + username + ".json?type=live").read() | |
| js = json.loads(f) | |
| if len(js) > 0 : | |
| print js | |
| js = js[0] | |
| #commandline = "ls" | |
| commandline = rtmpdump + " -r " + js["connect"] + "-f \"WIN 11,6,602,171\" -W http://www-cdn.jtvnw.net/widgets/live_site_player.ra3170e7f148ff63b2f1b4dfef2840842de54e7f8.swf -j " + js["token"] + " -v -y " + js["play"] + " | " + mplayer | |
| print commandline | |
| result = sub.Popen(commandline) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment