summaryrefslogtreecommitdiff
path: root/searx/engines/duckduckgo_definitions.py
diff options
context:
space:
mode:
authorBnyro <bnyro@tutanota.com>2024-04-07 16:17:11 +0200
committerMarkus Heiser <markus.heiser@darmarIT.de>2024-04-27 18:11:33 +0200
commit46efb2f36d327e618c5cd6af702b96fa9143fc27 (patch)
treeca6cd38a297c87b2c09df3d4dcbb3e287dd29b6d /searx/engines/duckduckgo_definitions.py
parentb3b1258e4e976ae27e8254fbc17339764276689b (diff)
downloadsearxng-46efb2f36d327e618c5cd6af702b96fa9143fc27.tar.gz
searxng-46efb2f36d327e618c5cd6af702b96fa9143fc27.zip
[feat] plugins: new unit converter plugin
Diffstat (limited to 'searx/engines/duckduckgo_definitions.py')
-rw-r--r--searx/engines/duckduckgo_definitions.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/searx/engines/duckduckgo_definitions.py b/searx/engines/duckduckgo_definitions.py
index e8146cc3e..59caed8ce 100644
--- a/searx/engines/duckduckgo_definitions.py
+++ b/searx/engines/duckduckgo_definitions.py
@@ -238,7 +238,10 @@ def unit_to_str(unit):
for prefix in WIKIDATA_PREFIX:
if unit.startswith(prefix):
wikidata_entity = unit[len(prefix) :]
- return WIKIDATA_UNITS.get(wikidata_entity, unit)
+ real_unit = WIKIDATA_UNITS.get(wikidata_entity)
+ if real_unit is None:
+ return unit
+ return real_unit['symbol']
return unit