]>
git.frykholm.com Git - svtplaydump.git/blob - svtplaydump.py
3 # (C) Copyright 2010 Mikael Frykholm <mikael@frykholm.com>
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>
19 # 0.2 added python 2.4 urlparse compatibility
22 from BeautifulSoup
import BeautifulSoup
23 from subprocess
import *
30 import urllib2
.urlparse
as urlparse
38 soup
= BeautifulSoup(urllib2
.urlopen(argv
[1]).read())
39 flashvars
= urlparse
.parse_qs(soup
.find("param", {"name":"flashvars",'value':True})['value'])
42 title
= soup
.find("div","info").ul
.li
.h2
.string
45 if 'dynamicStreams' in flashvars
:
46 url
= flashvars
['dynamicStreams'][0].split('url:')[1].split('.mp4,')[0] +'.mp4'
47 filename
= title
+".mp4"
48 print Popen(["rtmpdump",u
"-o"+filename
,"-r", url
], stdout
=PIPE
).communicate()[0]
49 if 'pathflv' in flashvars
:
50 rtmp
= flashvars
['pathflv'][0]
51 filename
= title
+".flv"
52 print Popen(["mplayer","-dumpstream","-dumpfile",filename
, rtmp
], stdout
=PIPE
).communicate()[0]
54 print "Could not find any streams"
57 if __name__
== "__main__":