mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-10-05 21:14:52 +00:00
[cleanup] Use format_field where applicable
This commit is contained in:
@@ -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):
|
||||
|
Reference in New Issue
Block a user