2 from __future__ import unicode_literals
4 from .common import InfoExtractor
11 class CWTVIE(InfoExtractor):
12 _VALID_URL = r'https?://(?:www\.)?cw(?:tv|seed)\.com/(?:shows/)?(?:[^/]+/){2}\?.*\bplay=(?P<id>[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12})'
14 'url': 'http://cwtv.com/shows/arrow/legends-of-yesterday/?play=6b15e985-9345-4f60-baf8-56e96be57c63',
16 'id': '6b15e985-9345-4f60-baf8-56e96be57c63',
18 'title': 'Legends of Yesterday',
19 'description': 'Oliver and Barry Allen take Kendra Saunders and Carter Hall to a remote location to keep them hidden from Vandal Savage while they figure out how to defeat him.',
25 'upload_date': '20151203',
26 'timestamp': 1449122100,
30 'skip_download': True,
33 'url': 'http://www.cwseed.com/shows/whose-line-is-it-anyway/jeff-davis-4/?play=24282b12-ead2-42f2-95ad-26770c2c6088',
35 'id': '24282b12-ead2-42f2-95ad-26770c2c6088',
37 'title': 'Jeff Davis 4',
38 'description': 'Jeff Davis is back to make you laugh.',
40 'series': 'Whose Line Is It Anyway?',
44 'upload_date': '20151006',
45 'timestamp': 1444107300,
49 'skip_download': True,
52 'url': 'http://cwtv.com/thecw/chroniclesofcisco/?play=8adebe35-f447-465f-ab52-e863506ff6d6',
53 'only_matching': True,
56 def _real_extract(self, url):
57 video_id = self._match_id(url)
58 video_data = self._download_json(
59 'http://metaframe.digitalsmiths.tv/v2/CWtv/assets/%s/partner/132?format=json' % video_id, video_id)
61 formats = self._extract_m3u8_formats(
62 video_data['videos']['variantplaylist']['uri'], video_id, 'mp4')
63 self._sort_formats(formats)
67 'width': image.get('width'),
68 'height': image.get('height'),
69 } for image_id, image in video_data['images'].items() if image.get('uri')] if video_data.get('images') else None
71 video_metadata = video_data['assetFields']
75 'url': video_metadata['UnicornCcUrl'],
77 } if video_metadata.get('UnicornCcUrl') else None
81 'title': video_metadata['title'],
82 'description': video_metadata.get('description'),
83 'duration': int_or_none(video_metadata.get('duration')),
84 'series': video_metadata.get('seriesName'),
85 'season_number': int_or_none(video_metadata.get('seasonNumber')),
86 'season': video_metadata.get('seasonName'),
87 'episode_number': int_or_none(video_metadata.get('episodeNumber')),
88 'timestamp': parse_iso8601(video_data.get('startTime')),
89 'thumbnails': thumbnails,
91 'subtitles': subtitles,