From b868936cd6d619f0e3a2c303028c132b761e6313 Mon Sep 17 00:00:00 2001 From: pukkandan Date: Sat, 7 Aug 2021 16:50:46 +0530 Subject: [cleanup] Misc --- yt_dlp/utils.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'yt_dlp/utils.py') 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 -- cgit v1.2.3