summaryrefslogtreecommitdiff
path: root/searx/engines/brave.py
diff options
context:
space:
mode:
Diffstat (limited to 'searx/engines/brave.py')
-rw-r--r--searx/engines/brave.py7
1 files changed, 2 insertions, 5 deletions
diff --git a/searx/engines/brave.py b/searx/engines/brave.py
index 04c2931f9..c5780a02c 100644
--- a/searx/engines/brave.py
+++ b/searx/engines/brave.py
@@ -132,6 +132,7 @@ from lxml import html
from searx import locales
from searx.utils import (
extract_text,
+ extr,
eval_xpath,
eval_xpath_list,
eval_xpath_getindex,
@@ -252,11 +253,7 @@ def response(resp):
if brave_category in ('search', 'goggles'):
return _parse_search(resp)
- datastr = ""
- for line in resp.text.split("\n"):
- if "const data = " in line:
- datastr = line.replace("const data = ", "").strip()[:-1]
- break
+ datastr = extr(resp.text, "const data = ", ";\n").strip()
json_data = js_variable_to_python(datastr)
json_resp = json_data[1]['data']['body']['response']