mirror of
https://github.com/searxng/searxng.git
synced 2025-07-25 06:09:18 +02:00
[enh] add re-usable func to filter text
This commit is contained in:
parent
0fb3f0e4ae
commit
0fa81fc782
6 changed files with 53 additions and 25 deletions
|
@ -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']
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue