diff options
author | jazzzooo <38244149+jazzzooo@users.noreply.github.com> | 2023-09-15 11:57:03 -0700 |
---|---|---|
committer | Markus Heiser <markus.heiser@darmarIT.de> | 2023-09-15 22:00:09 +0200 |
commit | 27477f51fdd91bcea4282da462c2923070524e20 (patch) | |
tree | 2cb53470df1d2b3f7effffe9b9acda9c16ffb1e7 /searx/utils.py | |
parent | 140125e6417381042c57bdbeaffb1c8de0364543 (diff) | |
download | searxng-27477f51fdd91bcea4282da462c2923070524e20.tar.gz searxng-27477f51fdd91bcea4282da462c2923070524e20.zip |
[fix] brave.news
Diffstat (limited to 'searx/utils.py')
-rw-r--r-- | searx/utils.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/searx/utils.py b/searx/utils.py index 9457ca87d..458cef7ea 100644 --- a/searx/utils.py +++ b/searx/utils.py @@ -40,6 +40,7 @@ _ECMA_UNESCAPE2_RE = re.compile(r'%([0-9a-fA-F]{2})', re.UNICODE) _JS_QUOTE_KEYS_RE = re.compile(r'([\{\s,])(\w+)(:)') _JS_VOID_RE = re.compile(r'void\s+[0-9]+|void\s*\([0-9]+\)') +_JS_DECIMAL_RE = re.compile(r":\s*\.") _STORAGE_UNIT_VALUE: Dict[str, int] = { 'TB': 1024 * 1024 * 1024 * 1024, @@ -699,7 +700,7 @@ def js_variable_to_python(js_variable): # replace simple quote by double quote parts[i] = '"' in_string = None - # + if not in_string: # replace void 0 by null # https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/void @@ -714,6 +715,7 @@ def js_variable_to_python(js_variable): # becomes # { "a": 12 } s = _JS_QUOTE_KEYS_RE.sub(r'\1"\2"\3', s) + s = _JS_DECIMAL_RE.sub(":0.", s) # replace the surogate character by colon s = s.replace(chr(1), ':') # load the JSON and return the result |