diff options
| author | Markus Heiser <markus.heiser@darmarIT.de> | 2025-11-25 12:51:08 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-25 12:51:08 +0100 |
| commit | 54a97e10431c1cdae910d3b37074a63eda7100fc (patch) | |
| tree | 3769dc3a7eae53ad96660cf47dfc476b8c26963d /searx/engines/duckduckgo.py | |
| parent | 0ee78c19dd5403560f14a13bbedeb75318ace45d (diff) | |
[mod] replace js_variable_to_python by js_obj_str_to_python (#2792) (#5477)
This patch is based on PR #2792 (old PR from 2023)
- js_obj_str_to_python handle more cases
- bring tests from chompjs ..
- comment out tests do not pass
The tests from chompjs give some overview of what is not implemented.
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx/engines/duckduckgo.py')
| -rw-r--r-- | searx/engines/duckduckgo.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/searx/engines/duckduckgo.py b/searx/engines/duckduckgo.py index 208eaf46e..dcf6543d6 100644 --- a/searx/engines/duckduckgo.py +++ b/searx/engines/duckduckgo.py @@ -407,7 +407,7 @@ def fetch_traits(engine_traits: EngineTraits): """ # pylint: disable=too-many-branches, too-many-statements, disable=import-outside-toplevel - from searx.utils import js_variable_to_python + from searx.utils import js_obj_str_to_python # fetch regions @@ -455,7 +455,7 @@ def fetch_traits(engine_traits: EngineTraits): js_code = extr(resp.text, 'languages:', ',regions') # type: ignore - languages = js_variable_to_python(js_code) + languages: dict[str, str] = js_obj_str_to_python(js_code) for eng_lang, name in languages.items(): if eng_lang == 'wt_WT': |