[jsinterp] Disable comment support
We need a proper lexer to be able to understand YouTube's code, which contains /* inside of strings. For now it's sufficient to just disable comment support altogether. Fixes #4976, fixes #4979, fixes #4980, fixes #4981, fixes #4982. Closes #4977.
This commit is contained in:
parent
785521bf4f
commit
3eff81fbf7
3 changed files with 18 additions and 4 deletions
|
@ -30,13 +30,10 @@ class JSInterpreter(object):
|
|||
def __init__(self, code, objects=None):
|
||||
if objects is None:
|
||||
objects = {}
|
||||
self.code = self._remove_comments(code)
|
||||
self.code = code
|
||||
self._functions = {}
|
||||
self._objects = objects
|
||||
|
||||
def _remove_comments(self, code):
|
||||
return re.sub(r'(?s)/\*.*?\*/', '', code)
|
||||
|
||||
def interpret_statement(self, stmt, local_vars, allow_recursion=100):
|
||||
if allow_recursion < 0:
|
||||
raise ExtractorError('Recursion limit reached')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue