about summary refs log tree commit diff
path: root/youtube_dl/utils.py
diff options
context:
space:
mode:
authorMichal Čihař <michal@cihar.com>2017-01-31 07:54:53 +0100
committerSergey M․ <dstftw@gmail.com>2017-02-03 03:04:33 +0700
commitb3ee552e4b918fb720111b23147e24fa5475a74b (patch)
tree73b6f8b9ec2e2b0932ce8e922bffca4dc11c1830 /youtube_dl/utils.py
parenta22b2fd19bd8c08d50f884d1903486d4f00f76ec (diff)
downloadyoutube-dl-b3ee552e4b918fb720111b23147e24fa5475a74b.tar.gz
youtube-dl-b3ee552e4b918fb720111b23147e24fa5475a74b.tar.xz
youtube-dl-b3ee552e4b918fb720111b23147e24fa5475a74b.zip
[utils] Handle single-line comments in js_to_json
Diffstat (limited to 'youtube_dl/utils.py')
-rw-r--r--youtube_dl/utils.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
index cf46711b9..6c462625b 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -2107,7 +2107,7 @@ def js_to_json(code):
         v = m.group(0)
         if v in ('true', 'false', 'null'):
             return v
-        elif v.startswith('/*') or v == ',':
+        elif v.startswith('/*') or v.startswith('//') or v == ',':
             return ""
 
         if v[0] in ("'", '"'):
@@ -2134,7 +2134,7 @@ def js_to_json(code):
     return re.sub(r'''(?sx)
         "(?:[^"\\]*(?:\\\\|\\['"nurtbfx/\n]))*[^"\\]*"|
         '(?:[^'\\]*(?:\\\\|\\['"nurtbfx/\n]))*[^'\\]*'|
-        /\*.*?\*/|,(?=\s*[\]}])|
+        /\*.*?\*/|//[^\n]*|,(?=\s*[\]}])|
         [a-zA-Z_][.a-zA-Z_0-9]*|
         \b(?:0[xX][0-9a-fA-F]+|0+[0-7]+)(?:\s*:)?|
         [0-9]+(?=\s*:)