mirror of
https://github.com/spaam/svtplay-dl.git
synced 2024-11-27 21:54:17 +01:00
Main function.. no global variables
This commit is contained in:
parent
a2229b17e8
commit
090fa40ba6
22
svtplay-dl
22
svtplay-dl
@ -52,23 +52,27 @@ def gethttp(url, output):
|
||||
|
||||
fd.close()
|
||||
|
||||
argv = sys.argv[1]
|
||||
DATA = getdata(argv)
|
||||
MATCH = re.search('dynamicStreams=(.*)\&\;background', DATA)
|
||||
if MATCH:
|
||||
def main():
|
||||
argv = sys.argv[1]
|
||||
DATA = getdata(argv)
|
||||
MATCH = re.search('dynamicStreams=(.*)\&\;background', DATA)
|
||||
if MATCH:
|
||||
new = MATCH.group(1)
|
||||
tmp = new.split("|")
|
||||
MATCH = re.search('url:(.*)\,', tmp[0])
|
||||
else:
|
||||
else:
|
||||
MATCH = re.search('pathflv=(.*)\&\;background', DATA)
|
||||
if not MATCH:
|
||||
print "Err: cant find stream"
|
||||
sys.exit(2)
|
||||
|
||||
STREAM = MATCH.group(1)
|
||||
OUTPUT = os.path.basename(STREAM)
|
||||
STREAM = MATCH.group(1)
|
||||
OUTPUT = os.path.basename(STREAM)
|
||||
|
||||
if STREAM[0:4] == "rtmp":
|
||||
if STREAM[0:4] == "rtmp":
|
||||
getrtmp(STREAM, OUTPUT)
|
||||
else:
|
||||
else:
|
||||
gethttp(STREAM, OUTPUT)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
Loading…
Reference in New Issue
Block a user