1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-27 21:54:17 +01:00

Better variable names

This commit is contained in:
Johan Andersson 2011-03-16 16:41:59 +01:00
parent 14a463c0bf
commit 0a0aa481c0

View File

@ -11,7 +11,7 @@ def getdata(url):
request.add_header = [('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')] request.add_header = [('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')]
response = urllib2.urlopen(request) response = urllib2.urlopen(request)
data = response.read() data = response.read()
response.close(); response.close()
return data return data
def calc_data(byte, total): def calc_data(byte, total):
@ -48,23 +48,22 @@ def gethttp(url, output):
fd.close() fd.close()
argv = sys.argv[1] argv = sys.argv[1]
text = getdata(argv) DATA = getdata(argv)
m = re.search('dynamicStreams=(.*)\&amp\;background', text) MATCH = re.search('dynamicStreams=(.*)\&amp\;background', DATA)
if MATCH:
if m: new = MATCH.group(1)
new = m.group(1)
tmp = new.split("|") tmp = new.split("|")
m = re.search('url:(.*)\,', tmp[0]) MATCH = re.search('url:(.*)\,', tmp[0])
else: else:
m = re.search('pathflv=(.*)\&amp\;background', text) MATCH = re.search('pathflv=(.*)\&amp\;background', DATA)
if not m: if not MATCH:
print "Err: cant find stream" print "Err: cant find stream"
sys.exit(2) sys.exit(2)
stream = m.group(1) STREAM = MATCH.group(1)
output = os.path.basename(stream) OUTPUT = os.path.basename(STREAM)
if stream[0:4] == "rtmp": if STREAM[0:4] == "rtmp":
getrtmp(stream, output) getrtmp(STREAM, OUTPUT)
else: else:
gethttp(stream, output) gethttp(STREAM, OUTPUT)