1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-09-03 00:25:08 +00:00

Ability to set a specific field in the file's metadata

Eg: `--parse-metadata "description:(?s)(?P<meta_comment>.+)"`
sets the "comment" field using `description`
This commit is contained in:
pukkandan
2021-04-03 13:59:55 +05:30
parent 54df8fc5b2
commit 84601bb72b
3 changed files with 12 additions and 6 deletions

View File

@ -45,7 +45,7 @@ class MetadataFromFieldPP(PostProcessor):
# replace %(..)s with regex group and escape other string parts
for match in re.finditer(r'%\((\w+)\)s', fmt):
regex += re.escape(fmt[lastpos:match.start()])
regex += r'(?P<%s>[^\r\n]+)' % match.group(1)
regex += r'(?P<%s>.+)' % match.group(1)
lastpos = match.end()
if lastpos < len(fmt):
regex += re.escape(fmt[lastpos:])