]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/tenplay.py
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
13 class TenPlayIE(InfoExtractor
):
14 _VALID_URL
= r
'https?://(?:www\.)?10play\.com\.au/(?:[^/]+/)+(?P<id>tpv\d{6}[a-z]{5})'
16 'url': 'https://10play.com.au/masterchef/episodes/season-1/masterchef-s1-ep-1/tpv190718kwzga',
18 'id': '6060533435001',
20 'title': 'MasterChef - S1 Ep. 1',
21 'description': 'md5:4fe7b78e28af8f2d900cd20d900ef95c',
23 'timestamp': 1240828200,
24 'upload_date': '20090427',
25 'uploader_id': '2199827728001',
28 # 'format': 'bestvideo',
29 'skip_download': True,
32 'url': 'https://10play.com.au/how-to-stay-married/web-extras/season-1/terrys-talks-ep-1-embracing-change/tpv190915ylupc',
33 'only_matching': True,
35 # BRIGHTCOVE_URL_TEMPLATE = 'https://players.brightcove.net/2199827728001/cN6vRtRQt_default/index.html?videoId=%s'
37 _FASTLY_URL_TEMPL
= 'https://10-selector.global.ssl.fastly.net/s/kYEXFC/media/%s?mbr=true&manifest=m3u&format=redirect'
39 def _real_extract(self
, url
):
40 content_id
= self
._match
_id
(url
)
41 data
= self
._download
_json
(
42 'https://10play.com.au/api/video/' + content_id
, content_id
)
43 video
= data
.get('video') or {}
44 metadata
= data
.get('metaData') or {}
45 brightcove_id
= video
.get('videoId') or metadata
['showContentVideoId']
46 # brightcove_url = smuggle_url(
47 # self.BRIGHTCOVE_URL_TEMPLATE % brightcove_id,
48 # {'geo_countries': ['AU']})
49 m3u8_url
= self
._request
_webpage
(HEADRequest(
50 self
._FASTLY
_URL
_TEMPL
% brightcove_id
), brightcove_id
).geturl()
51 if '10play-not-in-oz' in m3u8_url
:
52 self
.raise_geo_restricted(countries
=['AU'])
53 formats
= self
._extract
_m
3u8_formats
(m3u8_url
, brightcove_id
, 'mp4')
54 self
._sort
_formats
(formats
)
57 # '_type': 'url_transparent',
58 # 'url': brightcove_url,
61 'title': video
.get('title') or metadata
.get('pageContentName') or metadata
['showContentName'],
62 'description': video
.get('description'),
63 'age_limit': parse_age_limit(video
.get('showRatingClassification') or metadata
.get('showProgramClassification')),
64 'series': metadata
.get('showName'),
65 'season': metadata
.get('showContentSeason'),
66 'timestamp': parse_iso8601(metadata
.get('contentPublishDate') or metadata
.get('pageContentPublishDate')),
67 'thumbnail': video
.get('poster'),
68 'uploader_id': '2199827728001',
69 # 'ie_key': 'BrightcoveNew',