aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'youtube_dl/utils.py')
-rw-r--r--youtube_dl/utils.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
index 652dba59d..f3b0180ab 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -1717,11 +1717,12 @@ def encode_dict(d, encoding='utf-8'):
return dict((encode(k), encode(v)) for k, v in d.items())
-def dict_get(d, key_or_keys, default=None):
+def dict_get(d, key_or_keys, default=None, skip_false_values=True):
if isinstance(key_or_keys, (list, tuple)):
for key in key_or_keys:
- if d.get(key):
- return d[key]
+ if key not in d or d[key] is None or skip_false_values and not d[key]:
+ continue
+ return d[key]
return default
return d.get(key_or_keys, default)