diff options
author | pukkandan <pukkandan.ytdlp@gmail.com> | 2022-07-29 18:14:06 +0530 |
---|---|---|
committer | pukkandan <pukkandan.ytdlp@gmail.com> | 2022-07-31 02:20:10 +0530 |
commit | 4f547d6d2cdedc80e65a0a16532f98145c7244df (patch) | |
tree | b1a30c669c3d17acf6932dc7b13dfcde77ae305f /yt_dlp/postprocessor/metadataparser.py | |
parent | 2eae7d507c1b0749bb198df406720baaa7f70837 (diff) | |
download | hypervideo-pre-4f547d6d2cdedc80e65a0a16532f98145c7244df.tar.lz hypervideo-pre-4f547d6d2cdedc80e65a0a16532f98145c7244df.tar.xz hypervideo-pre-4f547d6d2cdedc80e65a0a16532f98145c7244df.zip |
[metadataparser] Don't set `None` when the field didn't match
Fixes: https://github.com/ytdl-org/youtube-dl/issues/31118#issuecomment-1198254512
Diffstat (limited to 'yt_dlp/postprocessor/metadataparser.py')
-rw-r--r-- | yt_dlp/postprocessor/metadataparser.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/yt_dlp/postprocessor/metadataparser.py b/yt_dlp/postprocessor/metadataparser.py index 51b927b91..f574f2330 100644 --- a/yt_dlp/postprocessor/metadataparser.py +++ b/yt_dlp/postprocessor/metadataparser.py @@ -1,7 +1,7 @@ import re from .common import PostProcessor -from ..utils import Namespace +from ..utils import Namespace, filter_dict class MetadataParserPP(PostProcessor): @@ -68,9 +68,9 @@ class MetadataParserPP(PostProcessor): if match is None: self.to_screen(f'Could not interpret {inp!r} as {out!r}') return - for attribute, value in match.groupdict().items(): + for attribute, value in filter_dict(match.groupdict()).items(): info[attribute] = value - self.to_screen('Parsed %s from %r: %r' % (attribute, template, value if value is not None else 'NA')) + self.to_screen(f'Parsed {attribute} from {template!r}: {value!r}') template = self.field_to_template(inp) out_re = re.compile(self.format_to_regex(out)) |