mirror of
https://github.com/yt-dlp/yt-dlp
synced 2024-12-29 22:24:25 +01:00
Fix --load-info-json
of playlists with failed entries
This commit is contained in:
parent
e339d25a0d
commit
7c7f7161fc
1 changed files with 4 additions and 3 deletions
|
@ -1504,10 +1504,12 @@ class YoutubeDL(object):
|
||||||
|
|
||||||
if 'entries' not in ie_result:
|
if 'entries' not in ie_result:
|
||||||
raise EntryNotInPlaylist('There are no entries')
|
raise EntryNotInPlaylist('There are no entries')
|
||||||
|
|
||||||
|
MissingEntry = object()
|
||||||
incomplete_entries = bool(ie_result.get('requested_entries'))
|
incomplete_entries = bool(ie_result.get('requested_entries'))
|
||||||
if incomplete_entries:
|
if incomplete_entries:
|
||||||
def fill_missing_entries(entries, indices):
|
def fill_missing_entries(entries, indices):
|
||||||
ret = [None] * max(indices)
|
ret = [MissingEntry] * max(indices)
|
||||||
for i, entry in zip(indices, entries):
|
for i, entry in zip(indices, entries):
|
||||||
ret[i - 1] = entry
|
ret[i - 1] = entry
|
||||||
return ret
|
return ret
|
||||||
|
@ -1561,7 +1563,7 @@ class YoutubeDL(object):
|
||||||
entry = None
|
entry = None
|
||||||
try:
|
try:
|
||||||
entry = get_entry(i)
|
entry = get_entry(i)
|
||||||
if entry is None:
|
if entry is MissingEntry:
|
||||||
raise EntryNotInPlaylist()
|
raise EntryNotInPlaylist()
|
||||||
except (IndexError, EntryNotInPlaylist):
|
except (IndexError, EntryNotInPlaylist):
|
||||||
if incomplete_entries:
|
if incomplete_entries:
|
||||||
|
@ -1655,7 +1657,6 @@ class YoutubeDL(object):
|
||||||
self.report_error(
|
self.report_error(
|
||||||
'Skipping the remaining entries in playlist "%s" since %d items failed extraction' % (playlist, failures))
|
'Skipping the remaining entries in playlist "%s" since %d items failed extraction' % (playlist, failures))
|
||||||
break
|
break
|
||||||
# TODO: skip failed (empty) entries?
|
|
||||||
playlist_results.append(entry_result)
|
playlist_results.append(entry_result)
|
||||||
ie_result['entries'] = playlist_results
|
ie_result['entries'] = playlist_results
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue