]>
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 u
'url': u
'http://www.spiegel.de/video/vulkan-tungurahua-in-ecuador-ist-wieder-aktiv-video-1259285.html',
11 u
'file': u
'1259285.mp4',
12 u
'md5': u
'2c2754212136f35fb4b19767d242f66e',
14 u
"title": u
"Vulkanausbruch in Ecuador: Der \"Feuerschlund\" ist wieder aktiv"
18 def _real_extract(self
, url
):
19 m
= re
.match(self
._VALID
_URL
, url
)
20 video_id
= m
.group('videoID')
22 webpage
= self
._download
_webpage
(url
, video_id
)
24 video_title
= self
._html
_search
_regex
(r
'<div class="module-title">(.*?)</div>',
27 xml_url
= u
'http://video2.spiegel.de/flash/' + video_id
+ u
'.xml'
28 xml_code
= self
._download
_webpage
(xml_url
, video_id
,
29 note
=u
'Downloading XML', errnote
=u
'Failed to download XML')
31 idoc
= xml
.etree
.ElementTree
.fromstring(xml_code
)
33 filename
= last_type
.findall('./filename')[0].text
34 duration
= float(last_type
.findall('./duration')[0].text
)
36 video_url
= 'http://video2.spiegel.de/flash/' + filename
37 video_ext
= filename
.rpartition('.')[2]