SearXNG is a free internet metasearch engine which aggregates results from various search services and databases. Users are neither tracked nor profiled.
Python bingbravedegoogleduckduckgogooglemetasearchprivacypythonqwantsearchsearch-enginesearxsearxngstartpageyahoo
[refactor] duckduckgo: use extr helper function in get_vqd
Bnyro1fe13d0ba4de
diff --git a/searx/engines/duckduckgo.py b/searx/engines/duckduckgo.pyindex fced014c1..feaa719d9 100644--- a/searx/engines/duckduckgo.py+++ b/searx/engines/duckduckgo.py@@ -24,6 +24,7 @@ from searx.utils import (from searx.network import get # see https://github.com/searxng/searxng/issues/762from searx import redisdbfrom searx.enginelib.traits import EngineTraits+from searx.utils import extrif TYPE_CHECKING:import logging@@ -120,8 +121,7 @@ def get_vqd(query):for script in doc.xpath("//script[@type='text/javascript']"):script = script.textif 'vqd="' in script:- value = script[script.index('vqd="') + 5 :]- value = value[: value.index('"')]+ value = extr(script, 'vqd="', '"')breaklogger.debug("new vqd value: '%s'", value)if value is not None:@@ -393,7 +393,7 @@ def fetch_traits(engine_traits: EngineTraits):"""# pylint: disable=too-many-branches, too-many-statements, disable=import-outside-toplevel- from searx.utils import extr, js_variable_to_python+ from searx.utils import js_variable_to_python# fetch regions