Repository: yt-dlp/yt-dlp

Issue:
nzonscreen.com
### DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

- [X] I understand that I will be **blocked** if I remove or skip any mandatory\* field

### Checklist

- [X] I'm reporting a new site support request
- [X] I've verified that I'm running yt-dlp version **2023.01.06** ([update instructions](https://github.com/yt-dlp/yt-dlp#update)) or later (specify commit)
- [X] I've checked that all provided URLs are playable in a browser with the same IP and same login details
- [X] I've checked that none of provided URLs [violate any copyrights](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#is-the-website-primarily-used-for-piracy) or contain any [DRM](https://en.wikipedia.org/wiki/Digital_rights_management) to the best of my knowledge
- [X] I've searched the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=) for similar issues **including closed ones**. DO NOT post duplicates
- [X] I've read the [guidelines for opening an issue](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#opening-an-issue)
- [X] I've read about [sharing account credentials](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#are-you-willing-to-share-account-details-if-needed) and am willing to share it if required

### Region

United States

### Example URLs

- Single video: https://www.nzonscreen.com/title/shoop-shoop-diddy-wop-cumma-cumma-wang-dang-1982

### Provide a description that is worded well enough to be understood

It would be great if nzonscreen.com was supported

### Provide verbose output that clearly demonstrates the problem

- [X] Run **your** yt-dlp command with **-vU** flag added (`yt-dlp -vU <your command line>`)
- [X] Copy the WHOLE output (starting with `[debug] Command-line config`) and insert it below

### Complete Verbose Output

```shell
[debug] Command-line config: ['-vU', 'https://www.nzonscreen.com/title/shoop-shoop-diddy-wop-cumma-cumma-wang-dang-1982']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version 2023.01.06 [6becd25] (zip)
[debug] Python 3.10.8 (CPython arm64 64bit) - macOS-12.4-arm64-arm-64bit (OpenSSL 1.1.1q  5 Jul 2022)
[debug] exe versions: ffmpeg 5.1.2 (setts), ffprobe 5.1.2
[debug] Optional libraries: Crypto-3.15.0, certifi-2022.06.15, sqlite3-2.6.0
[debug] Proxy map: {}
[debug] Loaded 1760 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Latest version: 2023.01.06, Current version: 2023.01.06
yt-dlp is up to date (2023.01.06)
[generic] Extracting URL: https://www.nzonscreen.com/title/shoop-shoop-diddy-wop-cumma-cumma-wang-dang-1982
[generic] shoop-shoop-diddy-wop-cumma-cumma-wang-dang-1982: Downloading webpage
WARNING: [generic] Falling back on generic information extractor
[generic] shoop-shoop-diddy-wop-cumma-cumma-wang-dang-1982: Extracting information
[debug] Looking for embeds
ERROR: Unsupported URL: https://www.nzonscreen.com/title/shoop-shoop-diddy-wop-cumma-cumma-wang-dang-1982
Traceback (most recent call last):
  File "/Users/g/Applications/./yt-dlp/yt_dlp/YoutubeDL.py", line 1502, in wrapper
    return func(self, *args, **kwargs)
  File "/Users/g/Applications/./yt-dlp/yt_dlp/YoutubeDL.py", line 1578, in __extract_info
    ie_result = ie.extract(url)
  File "/Users/g/Applications/./yt-dlp/yt_dlp/extractor/common.py", line 680, in extract
    ie_result = self._real_extract(url)
  File "/Users/g/Applications/./yt-dlp/yt_dlp/extractor/generic.py", line 2523, in _real_extract
    raise UnsupportedError(url)
yt_dlp.utils.UnsupportedError: Unsupported URL: https://www.nzonscreen.com/title/shoop-shoop-diddy-wop-cumma-cumma-wang-dang-1982
```



Discussion:
Similar to IGNIE, the video links are in JSON encoded as the value of an HTML attribute `#videoplayer[data-video-config]`. Other metadata can be harvested from the `<meta property="og:...` elements.
Thanks, @dirkf! Just opened a PR with a working extractor.

Resolving patch:
diff --git a/yt_dlp/extractor/_extractors.py b/yt_dlp/extractor/_extractors.py
--- a/yt_dlp/extractor/_extractors.py
+++ b/yt_dlp/extractor/_extractors.py
@@ -1287,6 +1287,7 @@
 )
 from .nuvid import NuvidIE
 from .nzherald import NZHeraldIE
+from .nzonscreen import NZOnScreenIE
 from .nzz import NZZIE
 from .odatv import OdaTVIE
 from .odnoklassniki import OdnoklassnikiIE
diff --git a/yt_dlp/extractor/nzonscreen.py b/yt_dlp/extractor/nzonscreen.py
new file mode 100644
--- /dev/null
+++ b/yt_dlp/extractor/nzonscreen.py
@@ -0,0 +1,93 @@
+from .common import InfoExtractor
+from ..utils import (
+    float_or_none,
+    int_or_none,
+    remove_end,
+    strip_or_none,
+    traverse_obj,
+    url_or_none,
+)
+
+
+class NZOnScreenIE(InfoExtractor):
+    _VALID_URL = r'^https://www\.nzonscreen\.com/title/(?P<id>[^/?#]+)'
+    _TESTS = [{
+        'url': 'https://www.nzonscreen.com/title/shoop-shoop-diddy-wop-cumma-cumma-wang-dang-1982',
+        'info_dict': {
+            'id': '726ed6585c6bfb30',
+            'ext': 'mp4',
+            'format_id': 'hi',
+            'display_id': 'shoop-shoop-diddy-wop-cumma-cumma-wang-dang-1982',
+            'title': 'Monte Video - "Shoop Shoop, Diddy Wop"',
+            'description': 'Monte Video - "Shoop Shoop, Diddy Wop"',
+            'alt_title': 'Shoop Shoop Diddy Wop Cumma Cumma Wang Dang | Music Video',
+            'thumbnail': r're:https://www\.nzonscreen\.com/content/images/.+\.jpg',
+            'duration': 158,
+        },
+        'params': {'skip_download': 'm3u8'},
+    }, {
+        'url': 'https://www.nzonscreen.com/title/shes-a-mod-1964?collection=best-of-the-60s',
+        'info_dict': {
+            'id': '3dbe709ff03c36f1',
+            'ext': 'mp4',
+            'format_id': 'hi',
+            'display_id': 'shes-a-mod-1964',
+            'title': 'Ray Columbus - \'She\'s A Mod\'',
+            'description': 'Ray Columbus - \'She\'s A Mod\'',
+            'alt_title': 'She\'s a Mod | Music Video',
+            'thumbnail': r're:https://www\.nzonscreen\.com/content/images/.+\.jpg',
+            'duration': 130,
+        },
+        'params': {'skip_download': 'm3u8'},
+    }, {
+        'url': 'https://www.nzonscreen.com/title/puha-and-pakeha-1968/overview',
+        'info_dict': {
+            'id': 'f86342544385ad8a',
+            'ext': 'mp4',
+            'format_id': 'hi',
+            'display_id': 'puha-and-pakeha-1968',
+            'title': 'Looking At New Zealand - Puha and Pakeha',
+            'alt_title': 'Looking at New Zealand - \'Pūhā and Pākehā\' | Television',
+            'description': 'An excerpt from this television programme.',
+            'duration': 212,
+            'thumbnail': r're:https://www\.nzonscreen\.com/content/images/.+\.jpg',
+        },
+        'params': {'skip_download': 'm3u8'},
+    }]
+
+    def _extract_formats(self, playlist):
+        for quality, (id_, url) in enumerate(traverse_obj(
+                playlist, ('h264', {'lo': 'lo_res', 'hi': 'hi_res'}), expected_type=url_or_none).items()):
+            yield {
+                'url': url,
+                'format_id': id_,
+                'ext': 'mp4',
+                'quality': quality,
+                'height': int_or_none(playlist.get('height')) if id_ == 'hi' else None,
+                'width': int_or_none(playlist.get('width')) if id_ == 'hi' else None,
+                'filesize_approx': float_or_none(traverse_obj(playlist, ('h264', f'{id_}_res_mb')), invscale=1024**2),
+            }
+
+    def _real_extract(self, url):
+        video_id = self._match_id(url)
+        webpage = self._download_webpage(url, video_id)
+
+        playlist = self._parse_json(self._html_search_regex(
+            r'data-video-config=\'([^\']+)\'', webpage, 'media data'), video_id)
+
+        return {
+            'id': playlist['uuid'],
+            'display_id': video_id,
+            'title': strip_or_none(playlist.get('label')),
+            'description': strip_or_none(playlist.get('description')),
+            'alt_title': strip_or_none(remove_end(
+                self._html_extract_title(webpage, default=None) or self._og_search_title(webpage),
+                ' | NZ On Screen')),
+            'thumbnail': traverse_obj(playlist, ('thumbnail', 'path')),
+            'duration': float_or_none(playlist.get('duration')),
+            'formats': list(self._extract_formats(playlist)),
+            'http_headers': {
+                'Referer': 'https://www.nzonscreen.com/',
+                'Origin': 'https://www.nzonscreen.com/',
+            }
+        }


Test patch: