]> jfr.im git - yt-dlp.git/commitdiff
[metadatafromfield] Do not detect numbers as field names
authorpukkandan <redacted>
Sun, 11 Jul 2021 23:40:08 +0000 (05:10 +0530)
committerpukkandan <redacted>
Sun, 11 Jul 2021 23:50:12 +0000 (05:20 +0530)
Related: https://github.com/yt-dlp/yt-dlp/issues/486#issuecomment-877820394

yt_dlp/postprocessor/metadatafromfield.py

index 8c795586cd2df8463aa332895daf4cb40cd30a53..d41ab4bfcf278741434d1a6ce69c21c398bc5918 100644 (file)
@@ -27,7 +27,7 @@ def __init__(self, downloader, formats):
 
     @staticmethod
     def field_to_template(tmpl):
-        if re.match(r'\w+$', tmpl):
+        if re.match(r'[a-zA-Z_]+$', tmpl):
             return '%%(%s)s' % tmpl
         return tmpl
 
@@ -63,7 +63,7 @@ def run(self, info):
                 continue
             for attribute, value in match.groupdict().items():
                 info[attribute] = value
-                self.to_screen('parsed %s from "%s": %s' % (attribute, dictn['in'], value if value is not None else 'NA'))
+                self.to_screen('parsed %s from "%s": %s' % (attribute, dictn['tmpl'], value if value is not None else 'NA'))
         return [], info