]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/spiegel.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
9 class SpiegelIE(InfoExtractor
):
10 _VALID_URL
= r
'https?://(?:www\.)?spiegel\.de/video/[^/]*-(?P<videoID>[0-9]+)(?:\.html)?(?:#.*)?$'
12 'url': 'http://www.spiegel.de/video/vulkan-tungurahua-in-ecuador-ist-wieder-aktiv-video-1259285.html',
13 'md5': '2c2754212136f35fb4b19767d242f66e',
17 'title': 'Vulkanausbruch in Ecuador: Der "Feuerschlund" ist wieder aktiv',
18 'description': 'md5:8029d8310232196eb235d27575a8b9f4',
22 'url': 'http://www.spiegel.de/video/schach-wm-videoanalyse-des-fuenften-spiels-video-1309159.html',
23 'md5': 'f2cdf638d7aa47654e251e1aee360af1',
27 'title': 'Schach-WM in der Videoanalyse: Carlsen nutzt die Fehlgriffe des Titelverteidigers',
28 'description': 'md5:c2322b65e58f385a820c10fa03b2d088',
32 'url': 'http://www.spiegel.de/video/johann-westhauser-videobotschaft-des-hoehlenforschers-video-1502367.html',
33 'md5': '54f58ba0e752e3c07bc2a26222dd0acf',
37 'title': 'Videobotschaft: Höhlenforscher Westhauser dankt seinen Rettern',
38 'description': 'md5:c6f1ec11413ebd1088b6813943e5fc91',
43 def _real_extract(self
, url
):
44 m
= re
.match(self
._VALID
_URL
, url
)
45 video_id
= m
.group('videoID')
47 webpage
= self
._download
_webpage
(url
, video_id
)
49 title
= self
._html
_search
_regex
(
50 r
'<div class="module-title">(.*?)</div>', webpage
, 'title')
51 description
= self
._html
_search
_meta
('description', webpage
, 'description')
53 base_url
= self
._search
_regex
(
54 r
'var\s+server\s*=\s*"([^"]+)\"', webpage
, 'server URL')
56 xml_url
= base_url
+ video_id
+ '.xml'
57 idoc
= self
._download
_xml
(xml_url
, video_id
)
61 'format_id': n
.tag
.rpartition('type')[2],
62 'url': base_url
+ n
.find('./filename').text
,
63 'width': int(n
.find('./width').text
),
64 'height': int(n
.find('./height').text
),
65 'abr': int(n
.find('./audiobitrate').text
),
66 'vbr': int(n
.find('./videobitrate').text
),
67 'vcodec': n
.find('./codec').text
,
71 # Blacklist type 6, it's extremely LQ and not available on the same server
72 if n
.tag
.startswith('type') and n
.tag
!= 'type6'
74 duration
= float(idoc
[0].findall('./duration')[0].text
)
76 self
._sort
_formats
(formats
)
81 'description': description
,