diff options
author | Sergey M․ <dstftw@gmail.com> | 2020-11-17 01:30:43 +0700 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2020-11-17 01:30:43 +0700 |
commit | fe07e788bf7718d429d6fc7e4bcb0c761ffd2cfc (patch) | |
tree | 1830df3e5dc69983c293384a62403a2d31b9f696 /youtube_dl | |
parent | 6d3bdcf2177ce75f8f95731186a4794412b9776d (diff) |
[utils] Skip ! prefixed code in js_to_json
Diffstat (limited to 'youtube_dl')
-rw-r--r-- | youtube_dl/utils.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index 737e2810e..321f903ab 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -4078,7 +4078,7 @@ def js_to_json(code): v = m.group(0) if v in ('true', 'false', 'null'): return v - elif v.startswith('/*') or v.startswith('//') or v == ',': + elif v.startswith('/*') or v.startswith('//') or v.startswith('!') or v == ',': return "" if v[0] in ("'", '"'): @@ -4103,7 +4103,8 @@ def js_to_json(code): {comment}|,(?={skip}[\]}}])| (?:(?<![0-9])[eE]|[a-df-zA-DF-Z_])[.a-zA-Z_0-9]*| \b(?:0[xX][0-9a-fA-F]+|0+[0-7]+)(?:{skip}:)?| - [0-9]+(?={skip}:) + [0-9]+(?={skip}:)| + !+ '''.format(comment=COMMENT_RE, skip=SKIP_RE), fix_kv, code) |