diff options
author | pukkandan <pukkandan.ytdlp@gmail.com> | 2022-03-28 08:21:45 +0530 |
---|---|---|
committer | pukkandan <pukkandan.ytdlp@gmail.com> | 2022-03-28 08:25:04 +0530 |
commit | 90137ca4bea0a22afec5bc6a0a2c8ff60ea76975 (patch) | |
tree | 63d03c7354f26faab59546517f7e96f0857359a2 /yt_dlp/YoutubeDL.py | |
parent | 1c1b2f96ae9696ef16b1b27d1a007bf89c683a0c (diff) | |
download | hypervideo-pre-90137ca4bea0a22afec5bc6a0a2c8ff60ea76975.tar.lz hypervideo-pre-90137ca4bea0a22afec5bc6a0a2c8ff60ea76975.tar.xz hypervideo-pre-90137ca4bea0a22afec5bc6a0a2c8ff60ea76975.zip |
[utils] Add `filter_dict`
Diffstat (limited to 'yt_dlp/YoutubeDL.py')
-rw-r--r-- | yt_dlp/YoutubeDL.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py index 434bef65f..6c2b94f3c 100644 --- a/yt_dlp/YoutubeDL.py +++ b/yt_dlp/YoutubeDL.py @@ -65,6 +65,7 @@ from .utils import ( ExistingVideoReached, expand_path, ExtractorError, + filter_dict, float_or_none, format_bytes, format_field, @@ -1574,13 +1575,9 @@ class YoutubeDL(object): if not info: return info - force_properties = dict( - (k, v) for k, v in ie_result.items() if v is not None) - for f in ('_type', 'url', 'id', 'extractor', 'extractor_key', 'ie_key'): - if f in force_properties: - del force_properties[f] new_result = info.copy() - new_result.update(force_properties) + new_result.update(filter_dict(ie_result, lambda k, v: ( + v is not None and k not in {'_type', 'url', 'id', 'extractor', 'extractor_key', 'ie_key'}))) # Extracted info may not be a video result (i.e. # info.get('_type', 'video') != video) but rather an url or |