mirror of
https://codeberg.org/polarisfm/youtube-dl
synced 2024-11-22 16:44:32 +01:00
Use multi_video instead of playlist
This commit is contained in:
parent
61ac1af174
commit
b01862992f
@ -13,12 +13,11 @@ class NZOnScreenIE(InfoExtractor):
|
|||||||
_VALID_URL = r'https?://(?:www\.)?nzonscreen\.com/title/(?P<id>[^/]+)'
|
_VALID_URL = r'https?://(?:www\.)?nzonscreen\.com/title/(?P<id>[^/]+)'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
'url': 'https://www.nzonscreen.com/title/watermark-2001',
|
'url': 'https://www.nzonscreen.com/title/watermark-2001',
|
||||||
'md5': '7743cb2c319c27357bc75dd8bcde5d11',
|
'md5': '9d8885fb0d8aeae80a15e7191e54230a',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'watermark-2001',
|
'id': 'watermark-2001',
|
||||||
'ext': 'm4v',
|
'ext': 'm4v',
|
||||||
'title': 'Watermark',
|
'title': 'Watermark',
|
||||||
'description': 'md5:c654662c3985fb0cef75812fbb378174',
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,7 +25,6 @@ class NZOnScreenIE(InfoExtractor):
|
|||||||
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)
|
||||||
|
|
||||||
# TODO more code goes here, for example ...
|
|
||||||
title = self._html_search_regex(r'<h1 class=\'hero-video__title\'>(.+?)</h1>',
|
title = self._html_search_regex(r'<h1 class=\'hero-video__title\'>(.+?)</h1>',
|
||||||
webpage, 'title')
|
webpage, 'title')
|
||||||
main_clip = self._html_search_regex(r'data-video-config=\'(.+?)\'',
|
main_clip = self._html_search_regex(r'data-video-config=\'(.+?)\'',
|
||||||
@ -34,7 +32,7 @@ class NZOnScreenIE(InfoExtractor):
|
|||||||
main_clip = json.loads(main_clip)
|
main_clip = json.loads(main_clip)
|
||||||
|
|
||||||
clips = self._html_search_regex(r'<div class=\'grid js_clip_selector (clip-selector)\'',
|
clips = self._html_search_regex(r'<div class=\'grid js_clip_selector (clip-selector)\'',
|
||||||
webpage, 'clips', 0)
|
webpage, 'clips', default=False)
|
||||||
|
|
||||||
if clips:
|
if clips:
|
||||||
clips_list = self._download_json('https://www.nzonscreen.com/html5/video_data/' + video_id,
|
clips_list = self._download_json('https://www.nzonscreen.com/html5/video_data/' + video_id,
|
||||||
@ -49,19 +47,29 @@ class NZOnScreenIE(InfoExtractor):
|
|||||||
clip_id = len(entries)
|
clip_id = len(entries)
|
||||||
|
|
||||||
entries.append({
|
entries.append({
|
||||||
'id': "%s-clip_%d_of_%d" % (video_id, clip_id + 1, len(clips_list)),
|
'id': '%s_part_%d' % (video_id, clip_id+1),
|
||||||
'title': title,
|
'title': title,
|
||||||
'description': self._og_search_description(webpage),
|
|
||||||
'url': url,
|
'url': url,
|
||||||
'formats': [],
|
'formats': [],
|
||||||
})
|
})
|
||||||
|
|
||||||
for fmt in ["h264", "flv"]:
|
for fmt in ["flv", "h264"]:
|
||||||
for definition in ["hd", "hi", "lo"]:
|
for definition in ["lo", "hi", "hd"]:
|
||||||
if clip[fmt][definition + "_res_mb"]:
|
if clip[fmt][definition + "_res_mb"]:
|
||||||
entries[clip_id]["formats"].append({
|
entries[clip_id]["formats"].append({
|
||||||
'format_id': '%s-%s' % (fmt, definition),
|
'format_id': '%s-%s' % (fmt, definition),
|
||||||
'url': clip[fmt][definition + "_res"],
|
'url': clip[fmt][definition + "_res"],
|
||||||
})
|
})
|
||||||
|
|
||||||
return self.playlist_result(entries, video_id, title, self._og_search_description(webpage))
|
if len(entries) == 1:
|
||||||
|
info = entries[0]
|
||||||
|
info['id'] = video_id
|
||||||
|
else:
|
||||||
|
info = {
|
||||||
|
'_type': 'multi_video',
|
||||||
|
'entries': entries,
|
||||||
|
'id': video_id,
|
||||||
|
'title': title,
|
||||||
|
}
|
||||||
|
|
||||||
|
return info
|
Loading…
Reference in New Issue
Block a user