1 from .common
import InfoExtractor
2 from ..compat
import compat_str
9 class PlayStuffIE(InfoExtractor
):
10 _VALID_URL
= r
'https?://(?:www\.)?play\.stuff\.co\.nz/details/(?P<id>[^/?#&]+)'
12 'url': 'https://play.stuff.co.nz/details/608778ac1de1c4001a3fa09a',
13 'md5': 'c82d3669e5247c64bc382577843e5bd0',
15 'id': '6250584958001',
17 'title': 'Episode 1: Rotorua/Mt Maunganui/Tauranga',
18 'description': 'md5:c154bafb9f0dd02d01fd4100fb1c1913',
19 'uploader_id': '6005208634001',
20 'timestamp': 1619491027,
21 'upload_date': '20210427',
23 'add_ie': ['BrightcoveNew'],
25 # geo restricted, bypassable
26 'url': 'https://play.stuff.co.nz/details/_6155660351001',
27 'only_matching': True,
29 BRIGHTCOVE_URL_TEMPLATE
= 'http://players.brightcove.net/%s/%s_default/index.html?videoId=%s'
31 def _real_extract(self
, url
):
32 video_id
= self
._match
_id
(url
)
34 webpage
= self
._download
_webpage
(url
, video_id
)
36 state
= self
._parse
_json
(
38 r
'__INITIAL_STATE__\s*=\s*({.+?})\s*;', webpage
, 'state'),
42 state
, lambda x
: x
['configurations']['accountId'],
43 compat_str
) or '6005208634001'
45 state
, lambda x
: x
['configurations']['playerId'],
46 compat_str
) or 'default'
49 for item_id
, video
in state
['items'].items():
50 if not isinstance(video
, dict):
53 video
, lambda x
: x
['content']['attributes']['assetId'],
57 entries
.append(self
.url_result(
59 self
.BRIGHTCOVE_URL_TEMPLATE
% (account_id
, player_id
, asset_id
),
60 {'geo_countries': ['NZ']}
),
61 'BrightcoveNew', video_id
))
63 return self
.playlist_result(entries
, video_id
)