mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-27 10:31:29 +00:00
parent
aeec0e44e2
commit
582fad70f5
|
@ -737,6 +737,7 @@ def expect_same_infodict(out):
|
||||||
test(NA_TEST_OUTTMPL, 'NA-NA-def-1234.mp4')
|
test(NA_TEST_OUTTMPL, 'NA-NA-def-1234.mp4')
|
||||||
test(NA_TEST_OUTTMPL, 'none-none-def-1234.mp4', outtmpl_na_placeholder='none')
|
test(NA_TEST_OUTTMPL, 'none-none-def-1234.mp4', outtmpl_na_placeholder='none')
|
||||||
test(NA_TEST_OUTTMPL, '--def-1234.mp4', outtmpl_na_placeholder='')
|
test(NA_TEST_OUTTMPL, '--def-1234.mp4', outtmpl_na_placeholder='')
|
||||||
|
test('%(non_existent.0)s', 'NA')
|
||||||
|
|
||||||
# String formatting
|
# String formatting
|
||||||
FMT_TEST_OUTTMPL = '%%(height)%s.%%(ext)s'
|
FMT_TEST_OUTTMPL = '%%(height)%s.%%(ext)s'
|
||||||
|
|
|
@ -6442,10 +6442,10 @@ def traverse_obj(
|
||||||
|
|
||||||
def _traverse_obj(obj, path, _current_depth=0):
|
def _traverse_obj(obj, path, _current_depth=0):
|
||||||
nonlocal depth
|
nonlocal depth
|
||||||
if obj is None:
|
|
||||||
return None
|
|
||||||
path = tuple(variadic(path))
|
path = tuple(variadic(path))
|
||||||
for i, key in enumerate(path):
|
for i, key in enumerate(path):
|
||||||
|
if obj is None:
|
||||||
|
return None
|
||||||
if isinstance(key, (list, tuple)):
|
if isinstance(key, (list, tuple)):
|
||||||
obj = [_traverse_obj(obj, sub_key, _current_depth) for sub_key in key]
|
obj = [_traverse_obj(obj, sub_key, _current_depth) for sub_key in key]
|
||||||
key = ...
|
key = ...
|
||||||
|
|
Loading…
Reference in a new issue