aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpukkandan <pukkandan@gmail.com>2021-01-30 14:36:10 +0530
committerpukkandan <pukkandan@gmail.com>2021-01-30 14:36:10 +0530
commit7c245ce87731a4e80f4ecaa744ffa7738e601f2d (patch)
treee73df93243387635333314917dd76c365407e159
parenteabce9017527096b20703f2f3a5d659c29b9ab31 (diff)
downloadhypervideo-pre-7c245ce87731a4e80f4ecaa744ffa7738e601f2d.tar.lz
hypervideo-pre-7c245ce87731a4e80f4ecaa744ffa7738e601f2d.tar.xz
hypervideo-pre-7c245ce87731a4e80f4ecaa744ffa7738e601f2d.zip
[metadatafromtitle] Fix bug when extracting data from numeric fields
:ci skip dl
-rw-r--r--youtube_dlc/postprocessor/metadatafromfield.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/youtube_dlc/postprocessor/metadatafromfield.py b/youtube_dlc/postprocessor/metadatafromfield.py
index eb774326b..716911b21 100644
--- a/youtube_dlc/postprocessor/metadatafromfield.py
+++ b/youtube_dlc/postprocessor/metadatafromfield.py
@@ -4,6 +4,7 @@ import re
from .common import PostProcessor
from ..compat import compat_str
+from ..utils import str_or_none
class MetadataFromFieldPP(PostProcessor):
@@ -48,8 +49,12 @@ class MetadataFromFieldPP(PostProcessor):
if field not in info:
self.report_warning('Video doesnot have a %s' % field)
continue
+ data_to_parse = str_or_none(info[field])
+ if data_to_parse is None:
+ self.report_warning('Field %s cannot be parsed' % field)
+ continue
self.write_debug('Searching for r"%s" in %s' % (regex, field))
- match = re.search(regex, info[field])
+ match = re.search(regex, data_to_parse)
if match is None:
self.report_warning('Could not interpret video %s as "%s"' % (field, dictn['format']))
continue