]> jfr.im git - yt-dlp.git/blame - youtube_dl/extractor/dctp.py
[dctp] fix test
[yt-dlp.git] / youtube_dl / extractor / dctp.py
CommitLineData
0865f397
PH
1# encoding: utf-8
2from __future__ import unicode_literals
3
4from .common import InfoExtractor
5
48a1e514 6
0865f397
PH
7class DctpTvIE(InfoExtractor):
8 _VALID_URL = r'^http://www.dctp.tv/(#/)?filme/(?P<id>.+?)/$'
48a1e514
PH
9 _TEST = {
10 'url': 'http://www.dctp.tv/filme/videoinstallation-fuer-eine-kaufhausfassade/',
11 'info_dict': {
75a4fc5b
PH
12 'id': '1324',
13 'display_id': 'videoinstallation-fuer-eine-kaufhausfassade',
48a1e514
PH
14 'ext': 'flv',
15 'title': 'Videoinstallation für eine Kaufhausfassade'}
16 }
0865f397
PH
17
18 def _real_extract(self, url):
19 video_id = self._match_id(url)
20 base_url = 'http://dctp-ivms2-restapi.s3.amazonaws.com/'
21 version_json = self._download_json(base_url + 'version.json', video_id)
22 version = version_json['version_name']
23 info_json = self._download_json(
f345fe9d 24 '{0}{1}/restapi/slugs/{2}.json'.format(base_url, version, video_id), video_id)
75a4fc5b 25 object_id = str(info_json['object_id'])
0865f397 26 meta_json = self._download_json(
f345fe9d 27 '{0}{1}/restapi/media/{2}.json'.format(base_url, version, object_id), video_id)
0865f397
PH
28 uuid = meta_json['uuid']
29 title = meta_json['title']
30 wide = meta_json['is_wide']
31 if wide:
32 ratio = '16x9'
33 else:
34 ratio = '4x3'
f345fe9d 35 play_path = 'mp4:{0}_dctp_0500_{1}.m4v'.format(uuid, ratio)
0865f397
PH
36
37 servers_json = self._download_json('http://www.dctp.tv/streaming_servers/', video_id)
38 url = servers_json[0]['endpoint']
39
40 return {
87673cd4 41 'id': object_id,
0865f397
PH
42 'title': title,
43 'format': 'rtmp',
44 'url': url,
45 'play_path': play_path,
46 'real_time': True,
87673cd4
PH
47 'ext': 'flv',
48 'display_id': video_id
0865f397
PH
49 }
50