summaryrefslogtreecommitdiff
path: root/searx/engines/qwant.py
diff options
context:
space:
mode:
authorAllen <64094914+allendema@users.noreply.github.com>2024-05-23 23:21:58 +0000
committerMarkus Heiser <markus.heiser@darmarIT.de>2024-05-29 17:56:17 +0200
commit0fa81fc782feb104bbd6616d87a6f441aad7d5bd (patch)
tree4fd2f697240307d616f8b49614787852e5923fc4 /searx/engines/qwant.py
parent0fb3f0e4aeecf62612cb6568910cf0f97c98cab9 (diff)
downloadsearxng-0fa81fc782feb104bbd6616d87a6f441aad7d5bd.tar.gz
searxng-0fa81fc782feb104bbd6616d87a6f441aad7d5bd.zip
[enh] add re-usable func to filter text
Diffstat (limited to 'searx/engines/qwant.py')
-rw-r--r--searx/engines/qwant.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/searx/engines/qwant.py b/searx/engines/qwant.py
index facd47bb9..989fe1445 100644
--- a/searx/engines/qwant.py
+++ b/searx/engines/qwant.py
@@ -312,13 +312,12 @@ def fetch_traits(engine_traits: EngineTraits):
# pylint: disable=import-outside-toplevel
from searx import network
from searx.locales import region_tag
+ from searx.utils import extr
resp = network.get(about['website'])
- text = resp.text
- text = text[text.find('INITIAL_PROPS') :]
- text = text[text.find('{') : text.find('</script>')]
+ json_string = extr(resp.text, 'INITIAL_PROPS = ', '</script>')
- q_initial_props = loads(text)
+ q_initial_props = loads(json_string)
q_locales = q_initial_props.get('locales')
eng_tag_list = set()