- video_id = self._match_id(url)
- webpage = self._download_webpage(url, video_id)
-
- object_id = self._html_search_meta('DC.identifier', webpage)
-
- servers_json = self._download_json(
- 'http://www.dctp.tv/elastic_streaming_client/get_streaming_server/',
- video_id, note='Downloading server list')
- server = servers_json[0]['server']
- m3u8_path = self._search_regex(
- r'\'([^\'"]+/playlist\.m3u8)"', webpage, 'm3u8 path')
- formats = self._extract_m3u8_formats(
- 'http://%s%s' % (server, m3u8_path), video_id, ext='mp4',
- entry_protocol='m3u8_native')
-
- title = self._og_search_title(webpage)
- description = self._html_search_meta('DC.description', webpage)
- upload_date = unified_strdate(
- self._html_search_meta('DC.date.created', webpage))
- thumbnail = self._og_search_thumbnail(webpage)
+ display_id = self._match_id(url)
+
+ version = self._download_json(
+ '%s/version.json' % self._BASE_URL, display_id,
+ 'Downloading version JSON')
+
+ restapi_base = '%s/%s/restapi' % (
+ self._BASE_URL, version['version_name'])
+
+ info = self._download_json(
+ '%s/slugs/%s.json' % (restapi_base, display_id), display_id,
+ 'Downloading video info JSON')
+
+ media = self._download_json(
+ '%s/media/%s.json' % (restapi_base, compat_str(info['object_id'])),
+ display_id, 'Downloading media JSON')
+
+ uuid = media['uuid']
+ title = media['title']
+ ratio = '16x9' if media.get('is_wide') else '4x3'
+ play_path = 'mp4:%s_dctp_0500_%s.m4v' % (uuid, ratio)
+
+ servers = self._download_json(
+ 'http://www.dctp.tv/streaming_servers/', display_id,
+ note='Downloading server list JSON', fatal=False)
+
+ if servers:
+ endpoint = next(
+ server['endpoint']
+ for server in servers
+ if url_or_none(server.get('endpoint'))
+ and 'cloudfront' in server['endpoint'])
+ else:
+ endpoint = 'rtmpe://s2pqqn4u96e4j8.cloudfront.net/cfx/st/'
+
+ app = self._search_regex(
+ r'^rtmpe?://[^/]+/(?P<app>.*)$', endpoint, 'app')
+
+ formats = [{
+ 'url': endpoint,
+ 'app': app,
+ 'play_path': play_path,
+ 'page_url': url,
+ 'player_url': 'http://svm-prod-dctptv-static.s3.amazonaws.com/dctptv-relaunch2012-110.swf',
+ 'ext': 'flv',
+ }]
+
+ thumbnails = []
+ images = media.get('images')
+ if isinstance(images, list):
+ for image in images:
+ if not isinstance(image, dict):
+ continue
+ image_url = url_or_none(image.get('url'))
+ if not image_url:
+ continue
+ thumbnails.append({
+ 'url': image_url,
+ 'width': int_or_none(image.get('width')),
+ 'height': int_or_none(image.get('height')),
+ })