mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-10-06 13:28:22 -04:00
@@ -3180,6 +3180,10 @@ def multipart_encode(data, boundary=None):
|
||||
return out, content_type
|
||||
|
||||
|
||||
def variadic(x, allowed_types=(str, bytes, dict)):
|
||||
return x if isinstance(x, collections.abc.Iterable) and not isinstance(x, allowed_types) else (x,)
|
||||
|
||||
|
||||
def dict_get(d, key_or_keys, default=None, skip_false_values=True):
|
||||
for val in map(d.get, variadic(key_or_keys)):
|
||||
if val is not None and (val or not skip_false_values):
|
||||
@@ -5446,10 +5450,6 @@ def get_first(obj, keys, **kwargs):
|
||||
return traverse_obj(obj, (..., *variadic(keys)), **kwargs, get_all=False)
|
||||
|
||||
|
||||
def variadic(x, allowed_types=(str, bytes, dict)):
|
||||
return x if isinstance(x, collections.abc.Iterable) and not isinstance(x, allowed_types) else (x,)
|
||||
|
||||
|
||||
def time_seconds(**kwargs):
|
||||
t = datetime.datetime.now(datetime.timezone(datetime.timedelta(**kwargs)))
|
||||
return t.timestamp()
|
||||
|
Reference in New Issue
Block a user