1 from .common
import InfoExtractor
2 from ..compat
import compat_str
11 class DctpTvIE(InfoExtractor
):
12 _VALID_URL
= r
'https?://(?:www\.)?dctp\.tv/(?:#/)?filme/(?P<id>[^/?#&]+)'
15 'url': 'http://www.dctp.tv/filme/videoinstallation-fuer-eine-kaufhausfassade/',
16 'md5': '3ffbd1556c3fe210724d7088fad723e3',
18 'id': '95eaa4f33dad413aa17b4ee613cccc6c',
19 'display_id': 'videoinstallation-fuer-eine-kaufhausfassade',
21 'title': 'Videoinstallation für eine Kaufhausfassade',
22 'description': 'Kurzfilm',
23 'thumbnail': r
're:^https?://.*\.jpg$',
25 'timestamp': 1302172322,
26 'upload_date': '20110407',
30 'url': 'http://www.dctp.tv/filme/sind-youtuber-die-besseren-lehrer/',
31 'only_matching': True,
34 _BASE_URL
= 'http://dctp-ivms2-restapi.s3.amazonaws.com'
36 def _real_extract(self
, url
):
37 display_id
= self
._match
_id
(url
)
39 version
= self
._download
_json
(
40 '%s/version.json' % self
._BASE
_URL
, display_id
,
41 'Downloading version JSON')
43 restapi_base
= '%s/%s/restapi' % (
44 self
._BASE
_URL
, version
['version_name'])
46 info
= self
._download
_json
(
47 '%s/slugs/%s.json' % (restapi_base
, display_id
), display_id
,
48 'Downloading video info JSON')
50 media
= self
._download
_json
(
51 '%s/media/%s.json' % (restapi_base
, compat_str(info
['object_id'])),
52 display_id
, 'Downloading media JSON')
55 title
= media
['title']
56 is_wide
= media
.get('is_wide')
59 def add_formats(suffix
):
60 templ
= 'https://%%s/%s_dctp_%s.m4v' % (uuid
, suffix
)
62 'format_id': 'hls-' + suffix
,
63 'url': templ
% 'cdn-segments.dctp.tv' + '/playlist.m3u8',
64 'protocol': 'm3u8_native',
66 'format_id': 's3-' + suffix
,
67 'url': templ
% 'completed-media.s3.amazonaws.com',
69 'format_id': 'http-' + suffix
,
70 'url': templ
% 'cdn-media.dctp.tv',
73 add_formats('0500_' + ('16x9' if is_wide
else '4x3'))
78 images
= media
.get('images')
79 if isinstance(images
, list):
81 if not isinstance(image
, dict):
83 image_url
= url_or_none(image
.get('url'))
88 'width': int_or_none(image
.get('width')),
89 'height': int_or_none(image
.get('height')),
94 'display_id': display_id
,
96 'alt_title': media
.get('subtitle'),
97 'description': media
.get('description') or media
.get('teaser'),
98 'timestamp': unified_timestamp(media
.get('created')),
99 'duration': float_or_none(media
.get('duration_in_ms'), scale
=1000),
100 'thumbnails': thumbnails
,