]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/dctp.py
04ff214f727826a60bbdde5ec17bb48ba004a91e
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
5 from ..compat
import compat_str
14 class DctpTvIE(InfoExtractor
):
15 _VALID_URL
= r
'https?://(?:www\.)?dctp\.tv/(?:#/)?filme/(?P<id>[^/?#&]+)'
18 'url': 'http://www.dctp.tv/filme/videoinstallation-fuer-eine-kaufhausfassade/',
20 'id': '95eaa4f33dad413aa17b4ee613cccc6c',
21 'display_id': 'videoinstallation-fuer-eine-kaufhausfassade',
23 'title': 'Videoinstallation für eine Kaufhausfassade',
24 'description': 'Kurzfilm',
25 'thumbnail': r
're:^https?://.*\.jpg$',
27 'timestamp': 1302172322,
28 'upload_date': '20110407',
32 'skip_download': True,
36 'url': 'http://www.dctp.tv/filme/sind-youtuber-die-besseren-lehrer/',
37 'only_matching': True,
40 _BASE_URL
= 'http://dctp-ivms2-restapi.s3.amazonaws.com'
42 def _real_extract(self
, url
):
43 display_id
= self
._match
_id
(url
)
45 version
= self
._download
_json
(
46 '%s/version.json' % self
._BASE
_URL
, display_id
,
47 'Downloading version JSON')
49 restapi_base
= '%s/%s/restapi' % (
50 self
._BASE
_URL
, version
['version_name'])
52 info
= self
._download
_json
(
53 '%s/slugs/%s.json' % (restapi_base
, display_id
), display_id
,
54 'Downloading video info JSON')
56 media
= self
._download
_json
(
57 '%s/media/%s.json' % (restapi_base
, compat_str(info
['object_id'])),
58 display_id
, 'Downloading media JSON')
61 title
= media
['title']
62 ratio
= '16x9' if media
.get('is_wide') else '4x3'
63 play_path
= 'mp4:%s_dctp_0500_%s.m4v' % (uuid
, ratio
)
65 servers
= self
._download
_json
(
66 'http://www.dctp.tv/streaming_servers/', display_id
,
67 note
='Downloading server list JSON', fatal
=False)
73 if url_or_none(server
.get('endpoint'))
74 and 'cloudfront' in server
['endpoint'])
76 endpoint
= 'rtmpe://s2pqqn4u96e4j8.cloudfront.net/cfx/st/'
78 app
= self
._search
_regex
(
79 r
'^rtmpe?://[^/]+/(?P<app>.*)$', endpoint
, 'app')
84 'play_path': play_path
,
86 'player_url': 'http://svm-prod-dctptv-static.s3.amazonaws.com/dctptv-relaunch2012-110.swf',
91 images
= media
.get('images')
92 if isinstance(images
, list):
94 if not isinstance(image
, dict):
96 image_url
= url_or_none(image
.get('url'))
101 'width': int_or_none(image
.get('width')),
102 'height': int_or_none(image
.get('height')),
107 'display_id': display_id
,
109 'alt_title': media
.get('subtitle'),
110 'description': media
.get('description') or media
.get('teaser'),
111 'timestamp': unified_timestamp(media
.get('created')),
112 'duration': float_or_none(media
.get('duration_in_ms'), scale
=1000),
113 'thumbnails': thumbnails
,