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