]>
jfr.im git - yt-dlp.git/blob - youtube_dl/extractor/spiegeltv.py
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
5 from ..utils
import float_or_none
8 class SpiegeltvIE(InfoExtractor
):
9 _VALID_URL
= r
'https?://(?:www\.)?spiegel\.tv/filme/(?P<id>[\-a-z0-9]+)'
11 'url': 'http://www.spiegel.tv/filme/flug-mh370/',
15 'title': 'Flug MH370',
16 'description': 'Das Rätsel um die Boeing 777 der Malaysia-Airlines',
17 'thumbnail': 're:http://.*\.jpg$',
21 'skip_download': True,
25 def _real_extract(self
, url
):
26 video_id
= self
._match
_id
(url
)
27 webpage
= self
._download
_webpage
(url
, video_id
)
28 title
= self
._html
_search
_regex
(r
'<h1.*?>(.*?)</h1>', webpage
, 'title')
30 apihost
= 'http://spiegeltv-ivms2-restapi.s3.amazonaws.com'
31 version_json
= self
._download
_json
(
32 '%s/version.json' % apihost
, video_id
,
33 note
='Downloading version information')
34 version_name
= version_json
['version_name']
36 slug_json
= self
._download
_json
(
37 '%s/%s/restapi/slugs/%s.json' % (apihost
, version_name
, video_id
),
39 note
='Downloading object information')
40 oid
= slug_json
['object_id']
42 media_json
= self
._download
_json
(
43 '%s/%s/restapi/media/%s.json' % (apihost
, version_name
, oid
),
44 video_id
, note
='Downloading media information')
45 uuid
= media_json
['uuid']
46 is_wide
= media_json
['is_wide']
48 server_json
= self
._download
_json
(
49 'http://www.spiegel.tv/streaming_servers/', video_id
,
50 note
='Downloading server information')
51 server
= server_json
[0]['endpoint']
54 for image
in media_json
['images']:
57 'width': image
['width'],
58 'height': image
['height'],
61 description
= media_json
['subtitle']
62 duration
= float_or_none(media_json
.get('duration_in_ms'), scale
=1000)
63 format
= '16x9' if is_wide
else '4x3'
65 url
= server
+ 'mp4:' + uuid
+ '_spiegeltv_0500_' + format
+ '.m4v'
72 'description': description
,
74 'thumbnails': thumbnails