ignore formats with falsy filesizes, add tests

This commit is contained in:
grqx_wsl 2024-10-04 17:39:53 +13:00
parent 56ae6a975b
commit 13b92fe1a3

View File

@ -59,11 +59,26 @@ class NZOnScreenIE(InfoExtractor):
'title': 'Flatmates - 1, First Episode',
},
'playlist_count': 5,
}, {
# hd format not present
'url': 'https://www.nzonscreen.com/title/reluctant-hero-2008',
'info_dict': {
'id': '847f5c91af65d44b',
'ext': 'mp4',
'format_id': 'hi',
'title': 'Reluctant Hero (clip 1)',
'description': 'Part one of four from this full length documentary.',
'display_id': 'reluctant-hero-2008',
'duration': 1108.0,
'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', 'hd': 'hd_res'}), expected_type=url_or_none).items()):
if traverse_obj(playlist, ('h264', f'{id_}_res_mb', {float_or_none})):
yield {
'url': url,
'format_id': id_,
@ -83,6 +98,7 @@ def _real_extract(self, url):
playlist = self._download_json(
f'https://www.nzonscreen.com/html5/video_data/{video_id}', video_id, 'media data')
# TODO: extract subtitles
if len(playlist) == 1:
playinfo = playlist[0]
return {