about summary refs log tree commit diff
path: root/youtube_dl/jsinterp.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2015-02-18 10:47:40 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2015-02-18 10:47:42 +0100
commit3eff81fbf72939abf885afcca2f1155cc976999b (patch)
tree6e6a48c9f37b4a217860b8f8986b0cf177fd2a37 /youtube_dl/jsinterp.py
parent785521bf4fbd99b2916bdab5d847d84424196c1d (diff)
downloadyoutube-dl-3eff81fbf72939abf885afcca2f1155cc976999b.tar.gz
youtube-dl-3eff81fbf72939abf885afcca2f1155cc976999b.tar.xz
youtube-dl-3eff81fbf72939abf885afcca2f1155cc976999b.zip
[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.
Diffstat (limited to 'youtube_dl/jsinterp.py')
-rw-r--r--youtube_dl/jsinterp.py5
1 files changed, 1 insertions, 4 deletions
diff --git a/youtube_dl/jsinterp.py b/youtube_dl/jsinterp.py
index 453e2732c..0e0c7d90d 100644
--- a/youtube_dl/jsinterp.py
+++ b/youtube_dl/jsinterp.py
@@ -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')