aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'yt_dlp/utils.py')
-rw-r--r--yt_dlp/utils.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/yt_dlp/utils.py b/yt_dlp/utils.py
index fd13febd6..4d83b1fbe 100644
--- a/yt_dlp/utils.py
+++ b/yt_dlp/utils.py
@@ -6161,8 +6161,11 @@ def to_high_limit_path(path):
return path
-def format_field(obj, field, template='%s', ignore=(None, ''), default='', func=None):
- val = obj.get(field, default)
+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