]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/spiegel.py
2 import xml
.etree
.ElementTree
4 from .common
import InfoExtractor
7 class SpiegelIE(InfoExtractor
):
8 _VALID_URL
= r
'https?://(?:www\.)?spiegel\.de/video/[^/]*-(?P<videoID>[0-9]+)(?:\.html)?(?:#.*)?$'
10 def _real_extract(self
, url
):
11 m
= re
.match(self
._VALID
_URL
, url
)
12 video_id
= m
.group('videoID')
14 webpage
= self
._download
_webpage
(url
, video_id
)
16 video_title
= self
._html
_search
_regex
(r
'<div class="module-title">(.*?)</div>',
19 xml_url
= u
'http://video2.spiegel.de/flash/' + video_id
+ u
'.xml'
20 xml_code
= self
._download
_webpage
(xml_url
, video_id
,
21 note
=u
'Downloading XML', errnote
=u
'Failed to download XML')
23 idoc
= xml
.etree
.ElementTree
.fromstring(xml_code
)
25 filename
= last_type
.findall('./filename')[0].text
26 duration
= float(last_type
.findall('./duration')[0].text
)
28 video_url
= 'http://video2.spiegel.de/flash/' + filename
29 video_ext
= filename
.rpartition('.')[2]