1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-27 13:44:14 +01:00

Inital commit

This commit is contained in:
Johan Andersson 2011-03-01 17:42:12 +01:00
commit cd8b995565

20
svtplay-dl Executable file
View File

@ -0,0 +1,20 @@
#!/usr/bin/env python
import re,urllib2,urllib,os,subprocess
def getdata(url):
request = urllib2.Request(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')]
response = urllib2.urlopen(request)
data = response.read()
response.close();
return data
text = getdata("http://svtplay.se/t/103466/dokument_inifran")
m = re.search('dynamicStreams=(.*)\&amp\;background', text)
new = m.group(1)
tmp = new.split("|")
m = re.search('url:(.*)\,',tmp[0])
stream = m.group(1)
output = os.path.basename(stream)
command = ["/usr/bin/rtmpdump","-r",stream,"-o",output]
subprocess.call(command)
print output