2 from __future__ import unicode_literals
5 from .common import InfoExtractor
7 class SpiegeltvIE(InfoExtractor):
8 _VALID_URL = r'https?://(?:www\.)?spiegel\.tv/filme/(?P<id>[\-a-z0-9]+)'
10 'url': 'http://www.spiegel.tv/filme/flug-mh370/',
11 'md5': '700d62dc485f3a81cf9d52144e5ead59',
15 'title': 'Flug MH370',
16 'description': 'Das Rätsel um die Boeing 777 der Malaysia-Airlines',
20 def _real_extract(self, url):
21 mobj = re.match(self._VALID_URL, url)
22 video_id = mobj.group('id')
24 webpage = self._download_webpage(url, video_id)
25 title = self._html_search_regex(r'<h1.*?>(.*?)</h1>', webpage, 'title')
27 apihost = 'http://spiegeltv-ivms2-restapi.s3.amazonaws.com';
29 version_json = self._download_json('%s/version.json' % apihost, None)
30 version_name = version_json['version_name']
32 slug_json = self._download_json('%s/%s/restapi/slugs/%s.json' % (apihost, version_name, video_id), None)
33 oid = slug_json['object_id']
35 media_json = self._download_json('%s/%s/restapi/media/%s.json' % (apihost, version_name, oid), None)
36 uuid = media_json['uuid']
37 is_wide = media_json['is_wide']
39 server_json = self._download_json('http://www.spiegel.tv/streaming_servers/', None)
40 server = server_json[0]['endpoint']
43 for image in media_json['images']:
44 thumbnails.append({'url': image['url'], 'resolution': str(image['width']) + 'x' + str(image['height']) })
46 description = media_json['subtitle']
47 duration = int(round(media_json['duration_in_ms'] / 1000))
54 url = server + 'mp4:' + uuid + '_spiegeltv_0500_' + format + '.m4v'
61 'description': description,
63 'thumbnails': thumbnails