]>
jfr.im git - yt-dlp.git/blob - youtube_dl/extractor/spiegel.py
2 import xml
.etree
.ElementTree
4 from .common
import InfoExtractor
5 from ..utils
import determine_ext
8 class SpiegelIE(InfoExtractor
):
9 _VALID_URL
= r
'https?://(?:www\.)?spiegel\.de/video/[^/]*-(?P<videoID>[0-9]+)(?:\.html)?(?:#.*)?$'
11 u
'url': u
'http://www.spiegel.de/video/vulkan-tungurahua-in-ecuador-ist-wieder-aktiv-video-1259285.html',
12 u
'file': u
'1259285.mp4',
13 u
'md5': u
'2c2754212136f35fb4b19767d242f66e',
15 u
"title": u
"Vulkanausbruch in Ecuador: Der \"Feuerschlund\" ist wieder aktiv"
19 u
'url': u
'http://www.spiegel.de/video/schach-wm-videoanalyse-des-fuenften-spiels-video-1309159.html',
20 u
'file': u
'1309159.mp4',
21 u
'md5': u
'f2cdf638d7aa47654e251e1aee360af1',
23 u
'title': u
'Schach-WM in der Videoanalyse: Carlsen nutzt die Fehlgriffe des Titelverteidigers'
27 def _real_extract(self
, url
):
28 m
= re
.match(self
._VALID
_URL
, url
)
29 video_id
= m
.group('videoID')
31 webpage
= self
._download
_webpage
(url
, video_id
)
33 video_title
= self
._html
_search
_regex
(
34 r
'<div class="module-title">(.*?)</div>', webpage
, u
'title')
36 xml_url
= u
'http://video2.spiegel.de/flash/' + video_id
+ u
'.xml'
37 xml_code
= self
._download
_webpage
(
39 note
=u
'Downloading XML', errnote
=u
'Failed to download XML')
41 idoc
= xml
.etree
.ElementTree
.fromstring(xml_code
)
45 'format_id': n
.tag
.rpartition('type')[2],
46 'url': u
'http://video2.spiegel.de/flash/' + n
.find('./filename').text
,
47 'width': int(n
.find('./width').text
),
48 'height': int(n
.find('./height').text
),
49 'abr': int(n
.find('./audiobitrate').text
),
50 'vbr': int(n
.find('./videobitrate').text
),
51 'vcodec': n
.find('./codec').text
,
55 # Blacklist type 6, it's extremely LQ and not available on the same server
56 if n
.tag
.startswith('type') and n
.tag
!= 'type6'
58 formats
.sort(key
=lambda f
: f
['vbr'])
59 duration
= float(idoc
[0].findall('./duration')[0].text
)