]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/spiegel.py
3 from .common
import InfoExtractor
6 class SpiegelIE(InfoExtractor
):
7 _VALID_URL
= r
'https?://(?:www\.)?spiegel\.de/video/[^/]*-(?P<videoID>[0-9]+)(?:\.html)?(?:#.*)?$'
9 u
'url': u
'http://www.spiegel.de/video/vulkan-tungurahua-in-ecuador-ist-wieder-aktiv-video-1259285.html',
10 u
'file': u
'1259285.mp4',
11 u
'md5': u
'2c2754212136f35fb4b19767d242f66e',
13 u
"title": u
"Vulkanausbruch in Ecuador: Der \"Feuerschlund\" ist wieder aktiv"
17 u
'url': u
'http://www.spiegel.de/video/schach-wm-videoanalyse-des-fuenften-spiels-video-1309159.html',
18 u
'file': u
'1309159.mp4',
19 u
'md5': u
'f2cdf638d7aa47654e251e1aee360af1',
21 u
'title': u
'Schach-WM in der Videoanalyse: Carlsen nutzt die Fehlgriffe des Titelverteidigers'
25 def _real_extract(self
, url
):
26 m
= re
.match(self
._VALID
_URL
, url
)
27 video_id
= m
.group('videoID')
29 webpage
= self
._download
_webpage
(url
, video_id
)
31 video_title
= self
._html
_search
_regex
(
32 r
'<div class="module-title">(.*?)</div>', webpage
, u
'title')
34 xml_url
= u
'http://video2.spiegel.de/flash/' + video_id
+ u
'.xml'
35 idoc
= self
._download
_xml
(
37 note
=u
'Downloading XML', errnote
=u
'Failed to download XML')
41 'format_id': n
.tag
.rpartition('type')[2],
42 'url': u
'http://video2.spiegel.de/flash/' + n
.find('./filename').text
,
43 'width': int(n
.find('./width').text
),
44 'height': int(n
.find('./height').text
),
45 'abr': int(n
.find('./audiobitrate').text
),
46 'vbr': int(n
.find('./videobitrate').text
),
47 'vcodec': n
.find('./codec').text
,
51 # Blacklist type 6, it's extremely LQ and not available on the same server
52 if n
.tag
.startswith('type') and n
.tag
!= 'type6'
54 formats
.sort(key
=lambda f
: f
['vbr'])
55 duration
= float(idoc
[0].findall('./duration')[0].text
)