1 from .common
import InfoExtractor
12 class NZOnScreenIE(InfoExtractor
):
13 _VALID_URL
= r
'https?://www\.nzonscreen\.com/title/(?P<id>[^/?#]+)'
15 'url': 'https://www.nzonscreen.com/title/shoop-shoop-diddy-wop-cumma-cumma-wang-dang-1982',
17 'id': '726ed6585c6bfb30',
20 'display_id': 'shoop-shoop-diddy-wop-cumma-cumma-wang-dang-1982',
21 'title': 'Monte Video - "Shoop Shoop, Diddy Wop"',
22 'description': 'Monte Video - "Shoop Shoop, Diddy Wop"',
23 'alt_title': 'Shoop Shoop Diddy Wop Cumma Cumma Wang Dang | Music Video',
24 'thumbnail': r
're:https://www\.nzonscreen\.com/content/images/.+\.jpg',
27 'params': {'skip_download': 'm3u8'},
29 'url': 'https://www.nzonscreen.com/title/shes-a-mod-1964?collection=best-of-the-60s',
31 'id': '3dbe709ff03c36f1',
34 'display_id': 'shes-a-mod-1964',
35 'title': 'Ray Columbus - \'She\'s A Mod\'',
36 'description': 'Ray Columbus - \'She\'s A Mod\'',
37 'alt_title': 'She\'s a Mod | Music Video',
38 'thumbnail': r
're:https://www\.nzonscreen\.com/content/images/.+\.jpg',
41 'params': {'skip_download': 'm3u8'},
43 'url': 'https://www.nzonscreen.com/title/puha-and-pakeha-1968/overview',
45 'id': 'f86342544385ad8a',
48 'display_id': 'puha-and-pakeha-1968',
49 'title': 'Looking At New Zealand - Puha and Pakeha',
50 'alt_title': 'Looking at New Zealand - \'Pūhā and Pākehā\' | Television',
51 'description': 'An excerpt from this television programme.',
53 'thumbnail': r
're:https://www\.nzonscreen\.com/content/images/.+\.jpg',
55 'params': {'skip_download': 'm3u8'},
58 def _extract_formats(self
, playlist
):
59 for quality
, (id_
, url
) in enumerate(traverse_obj(
60 playlist
, ('h264', {'lo': 'lo_res', 'hi': 'hi_res'}), expected_type
=url_or_none
).items()):
66 'height': int_or_none(playlist
.get('height')) if id_
== 'hi' else None,
67 'width': int_or_none(playlist
.get('width')) if id_
== 'hi' else None,
68 'filesize_approx': float_or_none(traverse_obj(playlist
, ('h264', f
'{id_}_res_mb')), invscale
=1024**2),
71 def _real_extract(self
, url
):
72 video_id
= self
._match
_id
(url
)
73 webpage
= self
._download
_webpage
(url
, video_id
)
75 playlist
= self
._parse
_json
(self
._html
_search
_regex
(
76 r
'data-video-config=\'([^
\']+)\'', webpage, 'media data
'), video_id)
79 'id': playlist['uuid
'],
80 'display_id
': video_id,
81 'title
': strip_or_none(playlist.get('label
')),
82 'description
': strip_or_none(playlist.get('description
')),
83 'alt_title
': strip_or_none(remove_end(
84 self._html_extract_title(webpage, default=None) or self._og_search_title(webpage),
86 'thumbnail
': traverse_obj(playlist, ('thumbnail
', 'path
')),
87 'duration
': float_or_none(playlist.get('duration
')),
88 'formats
': list(self._extract_formats(playlist)),
90 'Referer
': 'https
://www
.nzonscreen
.com
/',
91 'Origin
': 'https
://www
.nzonscreen
.com
/',