]>
Commit | Line | Data |
---|---|---|
e295618f | 1 | # coding: utf-8 |
0865f397 PH |
2 | from __future__ import unicode_literals |
3 | ||
4 | from .common import InfoExtractor | |
8e01f3ca S |
5 | from ..compat import compat_str |
6 | from ..utils import ( | |
7 | float_or_none, | |
8 | unified_strdate, | |
9 | ) | |
0865f397 | 10 | |
48a1e514 | 11 | |
0865f397 | 12 | class DctpTvIE(InfoExtractor): |
8e01f3ca | 13 | _VALID_URL = r'https?://(?:www\.)?dctp\.tv/(?:#/)?filme/(?P<id>[^/?#&]+)' |
48a1e514 PH |
14 | _TEST = { |
15 | 'url': 'http://www.dctp.tv/filme/videoinstallation-fuer-eine-kaufhausfassade/', | |
16 | 'info_dict': { | |
e295618f | 17 | 'id': '95eaa4f33dad413aa17b4ee613cccc6c', |
75a4fc5b | 18 | 'display_id': 'videoinstallation-fuer-eine-kaufhausfassade', |
8e01f3ca | 19 | 'ext': 'flv', |
e295618f YCH |
20 | 'title': 'Videoinstallation für eine Kaufhausfassade', |
21 | 'description': 'Kurzfilm', | |
22 | 'upload_date': '20110407', | |
ec85ded8 | 23 | 'thumbnail': r're:^https?://.*\.jpg$', |
8e01f3ca S |
24 | 'duration': 71.24, |
25 | }, | |
26 | 'params': { | |
27 | # rtmp download | |
28 | 'skip_download': True, | |
c56d7d89 | 29 | }, |
83fddfd4 | 30 | } |
0865f397 PH |
31 | |
32 | def _real_extract(self, url): | |
8e01f3ca | 33 | display_id = self._match_id(url) |
e295618f | 34 | |
8e01f3ca | 35 | webpage = self._download_webpage(url, display_id) |
0865f397 | 36 | |
8e01f3ca S |
37 | video_id = self._html_search_meta( |
38 | 'DC.identifier', webpage, 'video id', | |
39 | default=None) or self._search_regex( | |
40 | r'id=["\']uuid[^>]+>([^<]+)<', webpage, 'video id') | |
e295618f YCH |
41 | |
42 | title = self._og_search_title(webpage) | |
8e01f3ca S |
43 | |
44 | servers = self._download_json( | |
45 | 'http://www.dctp.tv/streaming_servers/', display_id, | |
46 | note='Downloading server list', fatal=False) | |
47 | ||
48 | if servers: | |
49 | endpoint = next( | |
50 | server['endpoint'] | |
51 | for server in servers | |
52 | if isinstance(server.get('endpoint'), compat_str) and | |
53 | 'cloudfront' in server['endpoint']) | |
54 | else: | |
55 | endpoint = 'rtmpe://s2pqqn4u96e4j8.cloudfront.net/cfx/st/' | |
56 | ||
57 | app = self._search_regex( | |
58 | r'^rtmpe?://[^/]+/(?P<app>.*)$', endpoint, 'app') | |
59 | ||
60 | formats = [{ | |
61 | 'url': endpoint, | |
62 | 'app': app, | |
63 | 'play_path': 'mp4:%s_dctp_0500_4x3.m4v' % video_id, | |
64 | 'page_url': url, | |
65 | 'player_url': 'http://svm-prod-dctptv-static.s3.amazonaws.com/dctptv-relaunch2012-109.swf', | |
66 | 'ext': 'flv', | |
67 | }] | |
68 | ||
e295618f YCH |
69 | description = self._html_search_meta('DC.description', webpage) |
70 | upload_date = unified_strdate( | |
71 | self._html_search_meta('DC.date.created', webpage)) | |
72 | thumbnail = self._og_search_thumbnail(webpage) | |
8e01f3ca S |
73 | duration = float_or_none(self._search_regex( |
74 | r'id=["\']duration_in_ms[^+]>(\d+)', webpage, 'duration', | |
75 | default=None), scale=1000) | |
0865f397 PH |
76 | |
77 | return { | |
8e01f3ca | 78 | 'id': video_id, |
0865f397 | 79 | 'title': title, |
e295618f | 80 | 'formats': formats, |
8e01f3ca | 81 | 'display_id': display_id, |
e295618f YCH |
82 | 'description': description, |
83 | 'upload_date': upload_date, | |
84 | 'thumbnail': thumbnail, | |
8e01f3ca | 85 | 'duration': duration, |
0865f397 | 86 | } |