Skip to content

Instantly share code, notes, and snippets.


blha303/ Secret

Last active Dec 19, 2015
What would you like to do?
from urllib2 import urlopen
import json
from sys import argv, exit
def getswfaddr(channelname):
return urlopen("" + channelname).geturl().split("&userAgent")[0]
def getstreaminfo(channelname):
data = json.loads(urlopen("" % channelname.lower()).read())
newd = {}
for i in data:
newd[i['display']] = i
return newd
def buildcmdline(channelname, data, quality="360p"):
data = data[quality]
if not "live-cdn" in data["connect"] and not "justintvlivefs" in data["connect"]:
justinlegacyparams = '-j "%s"' % data["token"].replace('"', r'\"')
justinlegacyparams = ""
out = '-r "%s/%s" %s --swfVfy "%s" -v -o -' % (data["connect"], data["play"], justinlegacyparams, getswfaddr(channelname))
return out
def main():
if len(argv) < 2:
print "Usage: %s channelname [quality]"
if len(argv) > 2:
quality = argv[2]
quality = "360p"
channelname = argv[1]
data = getstreaminfo(channelname)
print buildcmdline(channelname, data, quality=quality)
if __name__ == "__main__":
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment