1 from .common
import InfoExtractor
10 class DctpTvIE(InfoExtractor
):
11 _VALID_URL
= r
'https?://(?:www\.)?dctp\.tv/(?:#/)?filme/(?P<id>[^/?#&]+)'
14 'url': 'http://www.dctp.tv/filme/videoinstallation-fuer-eine-kaufhausfassade/',
15 'md5': '3ffbd1556c3fe210724d7088fad723e3',
17 'id': '95eaa4f33dad413aa17b4ee613cccc6c',
18 'display_id': 'videoinstallation-fuer-eine-kaufhausfassade',
20 'title': 'Videoinstallation für eine Kaufhausfassade',
21 'description': 'Kurzfilm',
22 'thumbnail': r
're:^https?://.*\.jpg$',
24 'timestamp': 1302172322,
25 'upload_date': '20110407',
29 'url': 'http://www.dctp.tv/filme/sind-youtuber-die-besseren-lehrer/',
30 'only_matching': True,
33 _BASE_URL
= 'http://dctp-ivms2-restapi.s3.amazonaws.com'
35 def _real_extract(self
, url
):
36 display_id
= self
._match
_id
(url
)
38 version
= self
._download
_json
(
39 f
'{self._BASE_URL}/version.json', display_id
,
40 'Downloading version JSON')
42 restapi_base
= '{}/{}/restapi'.format(
43 self
._BASE
_URL
, version
['version_name'])
45 info
= self
._download
_json
(
46 f
'{restapi_base}/slugs/{display_id}.json', display_id
,
47 'Downloading video info JSON')
49 media
= self
._download
_json
(
50 '{}/media/{}.json'.format(restapi_base
, str(info
['object_id'])),
51 display_id
, 'Downloading media JSON')
54 title
= media
['title']
55 is_wide
= media
.get('is_wide')
58 def add_formats(suffix
):
59 templ
= f
'https://%s/{uuid}_dctp_{suffix}.m4v'
61 'format_id': 'hls-' + suffix
,
62 'url': templ
% 'cdn-segments.dctp.tv' + '/playlist.m3u8',
63 'protocol': 'm3u8_native',
65 'format_id': 's3-' + suffix
,
66 'url': templ
% 'completed-media.s3.amazonaws.com',
68 'format_id': 'http-' + suffix
,
69 'url': templ
% 'cdn-media.dctp.tv',
72 add_formats('0500_' + ('16x9' if is_wide
else '4x3'))
77 images
= media
.get('images')
78 if isinstance(images
, list):
80 if not isinstance(image
, dict):
82 image_url
= url_or_none(image
.get('url'))
87 'width': int_or_none(image
.get('width')),
88 'height': int_or_none(image
.get('height')),
93 'display_id': display_id
,
95 'alt_title': media
.get('subtitle'),
96 'description': media
.get('description') or media
.get('teaser'),
97 'timestamp': unified_timestamp(media
.get('created')),
98 'duration': float_or_none(media
.get('duration_in_ms'), scale
=1000),
99 'thumbnails': thumbnails
,