diff options
Diffstat (limited to 'yt_dlp/utils.py')
-rw-r--r-- | yt_dlp/utils.py | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/yt_dlp/utils.py b/yt_dlp/utils.py index cb44a9c51..55bd67ea2 100644 --- a/yt_dlp/utils.py +++ b/yt_dlp/utils.py @@ -4975,13 +4975,10 @@ def to_high_limit_path(path): def format_field(obj, field=None, template='%s', ignore=(None, ''), default='', func=None): - if field is None: - val = obj if obj is not None else default - else: - val = obj.get(field, default) - if func and val not in ignore: - val = func(val) - return template % val if val not in ignore else default + val = traverse_obj(obj, *variadic(field)) + if val in ignore: + return default + return template % (func(val) if func else val) def clean_podcast_url(url): |