2 from __future__ import unicode_literals
4 from .common import InfoExtractor
12 class TenPlayIE(InfoExtractor):
13 _VALID_URL = r'https?://(?:www\.)?10play\.com\.au/[^/]+/episodes/[^/]+/[^/]+/(?P<id>tpv\d{6}[a-z]{5})'
15 'url': 'https://10play.com.au/masterchef/episodes/season-1/masterchef-s1-ep-1/tpv190718kwzga',
17 'id': '6060533435001',
19 'title': 'MasterChef - S1 Ep. 1',
20 'description': 'md5:4fe7b78e28af8f2d900cd20d900ef95c',
22 'timestamp': 1240828200,
23 'upload_date': '20090427',
24 'uploader_id': '2199827728001',
27 'format': 'bestvideo',
28 'skip_download': True,
31 BRIGHTCOVE_URL_TEMPLATE = 'https://players.brightcove.net/2199827728001/cN6vRtRQt_default/index.html?videoId=%s'
33 def _real_extract(self, url):
34 content_id = self._match_id(url)
35 data = self._download_json(
36 'https://10play.com.au/api/video/' + content_id, content_id)
37 video = data.get('video') or {}
38 metadata = data.get('metaData') or {}
39 brightcove_id = video.get('videoId') or metadata['showContentVideoId']
40 brightcove_url = smuggle_url(
41 self.BRIGHTCOVE_URL_TEMPLATE % brightcove_id,
42 {'geo_countries': ['AU']})
45 '_type': 'url_transparent',
46 'url': brightcove_url,
48 'title': video.get('title') or metadata.get('pageContentName') or metadata.get('showContentName'),
49 'description': video.get('description'),
50 'age_limit': parse_age_limit(video.get('showRatingClassification') or metadata.get('showProgramClassification')),
51 'series': metadata.get('showName'),
52 'season': metadata.get('showContentSeason'),
53 'timestamp': parse_iso8601(metadata.get('contentPublishDate') or metadata.get('pageContentPublishDate')),
54 'ie_key': 'BrightcoveNew',