]> Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/dctp.py
Tidy the changelog.
[youtubedl] / youtube_dl / extractor / dctp.py
1 # encoding: utf-8
2 from __future__ import unicode_literals
3
4 from .common import InfoExtractor
5 from ..compat import compat_str
6
7
8 class DctpTvIE(InfoExtractor):
9 _VALID_URL = r'http://www.dctp.tv/(#/)?filme/(?P<id>.+?)/$'
10 _TEST = {
11 'url': 'http://www.dctp.tv/filme/videoinstallation-fuer-eine-kaufhausfassade/',
12 'info_dict': {
13 'id': '1324',
14 'display_id': 'videoinstallation-fuer-eine-kaufhausfassade',
15 'ext': 'flv',
16 'title': 'Videoinstallation für eine Kaufhausfassade'
17 }
18 }
19
20 def _real_extract(self, url):
21 video_id = self._match_id(url)
22 base_url = 'http://dctp-ivms2-restapi.s3.amazonaws.com/'
23 version_json = self._download_json(
24 base_url + 'version.json',
25 video_id, note='Determining file version')
26 version = version_json['version_name']
27 info_json = self._download_json(
28 '{0}{1}/restapi/slugs/{2}.json'.format(base_url, version, video_id),
29 video_id, note='Fetching object ID')
30 object_id = compat_str(info_json['object_id'])
31 meta_json = self._download_json(
32 '{0}{1}/restapi/media/{2}.json'.format(base_url, version, object_id),
33 video_id, note='Downloading metadata')
34 uuid = meta_json['uuid']
35 title = meta_json['title']
36 wide = meta_json['is_wide']
37 if wide:
38 ratio = '16x9'
39 else:
40 ratio = '4x3'
41 play_path = 'mp4:{0}_dctp_0500_{1}.m4v'.format(uuid, ratio)
42
43 servers_json = self._download_json(
44 'http://www.dctp.tv/streaming_servers/',
45 video_id, note='Downloading server list')
46 url = servers_json[0]['endpoint']
47
48 return {
49 'id': object_id,
50 'title': title,
51 'format': 'rtmp',
52 'url': url,
53 'play_path': play_path,
54 'rtmp_real_time': True,
55 'ext': 'flv',
56 'display_id': video_id
57 }