always return a playlist result regardless of its length

This commit is contained in:
grqx_wsl 2024-10-06 00:45:28 +13:00
parent 772e292c33
commit b7d4c50ef3

View File

@ -135,39 +135,20 @@ def _real_extract(self, url):
playlist = self._download_json( playlist = self._download_json(
f'https://www.nzonscreen.com/html5/video_data/{video_id}', video_id, 'Downloading media data') f'https://www.nzonscreen.com/html5/video_data/{video_id}', video_id, 'Downloading media data')
if len(playlist) == 1: return self.playlist_result([{
playinfo = playlist[0] 'alt_title': title if len(playlist) == 1 else None,
return { 'display_id': video_id,
'alt_title': title, 'http_headers': {
'display_id': video_id, 'Referer': 'https://www.nzonscreen.com/',
'http_headers': { 'Origin': 'https://www.nzonscreen.com/',
'Referer': 'https://www.nzonscreen.com/', },
'Origin': 'https://www.nzonscreen.com/', 'subtitles': self.extract_subtitles(playinfo, video_id),
}, **traverse_obj(playinfo, {
'subtitles': self.extract_subtitles(playinfo, video_id), 'formats': {self._extract_formats},
**traverse_obj(playinfo, { 'id': 'uuid',
'formats': {self._extract_formats}, 'title': ('label', {strip_or_none}),
'id': 'uuid', 'description': ('description', {strip_or_none}),
'title': ('label', {strip_or_none}), 'thumbnail': ('thumbnail', 'path'),
'description': ('description', {strip_or_none}), 'duration': ('duration', {float_or_none}),
'thumbnail': ('thumbnail', 'path'), }),
'duration': ('duration', {float_or_none}), } for playinfo in playlist], video_id, title)
}),
}
else:
return self.playlist_result([{
'display_id': video_id,
'http_headers': {
'Referer': 'https://www.nzonscreen.com/',
'Origin': 'https://www.nzonscreen.com/',
},
'subtitles': self.extract_subtitles(playinfo, video_id),
**traverse_obj(playinfo, {
'formats': {self._extract_formats},
'id': 'uuid',
'title': ('label', {strip_or_none}),
'description': ('description', {strip_or_none}),
'thumbnail': ('thumbnail', 'path'),
'duration': ('duration', {float_or_none}),
}),
} for playinfo in playlist], video_id, title)