]> jfr.im git - yt-dlp.git/blame - youtube_dl/extractor/dctp.py
Add support for https for all extractors as preventive and future-proof measure
[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
6ebb0dca 5from ..compat import compat_str
0865f397 6
48a1e514 7
0865f397 8class DctpTvIE(InfoExtractor):
5886b38d 9 _VALID_URL = r'https?://www.dctp.tv/(#/)?filme/(?P<id>.+?)/$'
48a1e514
PH
10 _TEST = {
11 'url': 'http://www.dctp.tv/filme/videoinstallation-fuer-eine-kaufhausfassade/',
12 'info_dict': {
75a4fc5b
PH
13 'id': '1324',
14 'display_id': 'videoinstallation-fuer-eine-kaufhausfassade',
48a1e514 15 'ext': 'flv',
83fddfd4 16 'title': 'Videoinstallation für eine Kaufhausfassade'
c56d7d89
S
17 },
18 'params': {
19 # rtmp download
20 'skip_download': True,
48a1e514 21 }
83fddfd4 22 }
0865f397
PH
23
24 def _real_extract(self, url):
25 video_id = self._match_id(url)
26 base_url = 'http://dctp-ivms2-restapi.s3.amazonaws.com/'
6ebb0dca
PH
27 version_json = self._download_json(
28 base_url + 'version.json',
29 video_id, note='Determining file version')
0865f397
PH
30 version = version_json['version_name']
31 info_json = self._download_json(
6ebb0dca
PH
32 '{0}{1}/restapi/slugs/{2}.json'.format(base_url, version, video_id),
33 video_id, note='Fetching object ID')
34 object_id = compat_str(info_json['object_id'])
0865f397 35 meta_json = self._download_json(
6ebb0dca
PH
36 '{0}{1}/restapi/media/{2}.json'.format(base_url, version, object_id),
37 video_id, note='Downloading metadata')
0865f397
PH
38 uuid = meta_json['uuid']
39 title = meta_json['title']
40 wide = meta_json['is_wide']
41 if wide:
42 ratio = '16x9'
43 else:
44 ratio = '4x3'
f345fe9d 45 play_path = 'mp4:{0}_dctp_0500_{1}.m4v'.format(uuid, ratio)
0865f397 46
6ebb0dca
PH
47 servers_json = self._download_json(
48 'http://www.dctp.tv/streaming_servers/',
49 video_id, note='Downloading server list')
0865f397
PH
50 url = servers_json[0]['endpoint']
51
52 return {
87673cd4 53 'id': object_id,
0865f397
PH
54 'title': title,
55 'format': 'rtmp',
56 'url': url,
57 'play_path': play_path,
7bb3ceb4 58 'rtmp_real_time': True,
87673cd4
PH
59 'ext': 'flv',
60 'display_id': video_id
0865f397 61 }