mirror of
https://github.com/ytdl-org/youtube-dl
synced 2025-02-03 01:00:10 +09:00
[test] Improve shortcut processing for test playlists
* check all playlist counts, not just max * also consider any actual playlist in the test case
This commit is contained in:
parent
77151943cd
commit
35230a2b5a
@ -35,6 +35,8 @@ from youtube_dl.utils import (
|
||||
ExtractorError,
|
||||
error_to_compat_str,
|
||||
format_bytes,
|
||||
T,
|
||||
traverse_obj,
|
||||
UnavailableVideoError,
|
||||
)
|
||||
from youtube_dl.extractor import get_info_extractor
|
||||
@ -120,10 +122,14 @@ def generator(test_case, tname):
|
||||
|
||||
params = get_params(test_case.get('params', {}))
|
||||
params['outtmpl'] = tname + '_' + params['outtmpl']
|
||||
if is_playlist and 'playlist' not in test_case:
|
||||
params.setdefault('extract_flat', 'in_playlist')
|
||||
params.setdefault('playlistend', test_case.get('playlist_mincount'))
|
||||
params.setdefault('skip_download', True)
|
||||
if is_playlist:
|
||||
if 'playlist' not in test_case:
|
||||
params.setdefault('extract_flat', 'in_playlist')
|
||||
params.setdefault('skip_download', True)
|
||||
# only process enough items for specified tests
|
||||
pl_counts = traverse_obj(test_case, (None, ('playlist_count', 'playlist_mincount', 'playlist_maxcount', ('playlist', T(len)))))
|
||||
if pl_counts is not None:
|
||||
params.setdefault('playlistend', max(pl_counts) + 1)
|
||||
|
||||
ydl = YoutubeDL(params, auto_init=False)
|
||||
ydl.add_default_info_extractors()
|
||||
|
Loading…
Reference in New Issue
Block a user