aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordirkf <fieldhouse@gmx.net>2025-03-07 19:37:56 +0000
committerdirkf <fieldhouse@gmx.net>2025-03-11 02:00:24 +0000
commitaf049e309bfa47141a9788cd1730dd50dad6176d (patch)
tree9c27748ef0da8024b3b60d68065209d6a3515930
parent94849bc997d232b344b0f3666198feec7b004b43 (diff)
[JSInterp] Handle undefined, etc, passed to JS_RegExp and Exception
-rw-r--r--youtube_dl/jsinterp.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/youtube_dl/jsinterp.py b/youtube_dl/jsinterp.py
index c3ee3bb03..9b4157a43 100644
--- a/youtube_dl/jsinterp.py
+++ b/youtube_dl/jsinterp.py
@@ -408,6 +408,7 @@ class JSInterpreter(object):
class Exception(ExtractorError):
def __init__(self, msg, *args, **kwargs):
expr = kwargs.pop('expr', None)
+ msg = str_or_none(msg, default='"None"')
if expr is not None:
msg = '{0} in: {1!r:.100}'.format(msg.rstrip(), expr)
super(JSInterpreter.Exception, self).__init__(msg, *args, **kwargs)
@@ -435,6 +436,7 @@ class JSInterpreter(object):
flags, _ = self.regex_flags(flags)
# First, avoid https://github.com/python/cpython/issues/74534
self.__self = None
+ pattern_txt = str_or_none(pattern_txt) or '(?:)'
self.__pattern_txt = pattern_txt.replace('[[', r'[\[')
self.__flags = flags