mirror of
https://github.com/yt-dlp/yt-dlp
synced 2025-01-31 12:32:27 +01:00
return url results in playlists
This commit is contained in:
parent
2584cdbf33
commit
2f14c2b4d0
1 changed files with 28 additions and 3 deletions
|
@ -2,8 +2,10 @@ from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
float_or_none,
|
float_or_none,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
|
smuggle_url,
|
||||||
strip_or_none,
|
strip_or_none,
|
||||||
traverse_obj,
|
traverse_obj,
|
||||||
|
unsmuggle_url,
|
||||||
url_or_none,
|
url_or_none,
|
||||||
urljoin,
|
urljoin,
|
||||||
)
|
)
|
||||||
|
@ -144,6 +146,8 @@ class NZOnScreenIE(InfoExtractor):
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
|
url, smuggled_data = unsmuggle_url(url, {})
|
||||||
|
ep_idx = smuggled_data.get('ep')
|
||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
title = strip_or_none((
|
title = strip_or_none((
|
||||||
|
@ -152,10 +156,31 @@ class NZOnScreenIE(InfoExtractor):
|
||||||
playlist = self._download_json(
|
playlist = self._download_json(
|
||||||
f'https://www.nzonscreen.com/html5/video_data/{video_id}', video_id,
|
f'https://www.nzonscreen.com/html5/video_data/{video_id}', video_id,
|
||||||
'Downloading media data')
|
'Downloading media data')
|
||||||
|
playlist_len = len(playlist)
|
||||||
|
|
||||||
if self._yes_playlist(video_id, traverse_obj(playlist, (0, 'id'))):
|
if ep_idx is None and playlist_len > 1 and self._yes_playlist(video_id, traverse_obj(playlist, (0, 'id'))):
|
||||||
return self.playlist_result(
|
return self.playlist_result(
|
||||||
[self._extract_from_api_resp(vid_info, len(playlist) == 1, title, video_id) for vid_info in playlist],
|
[self.url_result(smuggle_url(url, {'ep': idx}), NZOnScreenIE.ie_key()) for idx in range(playlist_len)],
|
||||||
playlist_id=video_id, playlist_title=title)
|
playlist_id=video_id, playlist_title=title)
|
||||||
|
|
||||||
return self._extract_from_api_resp(playlist[0], len(playlist) == 1, title, video_id)
|
vid_info = playlist[ep_idx or 0]
|
||||||
|
return {
|
||||||
|
'alt_title': title if playlist_len == 1 else None,
|
||||||
|
'display_id': video_id,
|
||||||
|
'http_headers': {
|
||||||
|
'Referer': 'https://www.nzonscreen.com/',
|
||||||
|
'Origin': 'https://www.nzonscreen.com/',
|
||||||
|
},
|
||||||
|
'subtitles': {'en': [{
|
||||||
|
'url': traverse_obj(vid_info, ('h264', 'caption_url', {urljoin('https://www.nzonscreen.com')})),
|
||||||
|
'ext': 'vtt',
|
||||||
|
}]},
|
||||||
|
'formats': self._extract_formats(vid_info),
|
||||||
|
**traverse_obj(vid_info, {
|
||||||
|
'id': 'uuid',
|
||||||
|
'title': ('label', {strip_or_none}),
|
||||||
|
'description': ('description', {strip_or_none}),
|
||||||
|
'thumbnail': ('thumbnail', 'path'),
|
||||||
|
'duration': ('duration', {float_or_none}),
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue