diff options
author | Markus Heiser <markus.heiser@darmarit.de> | 2024-11-27 14:56:14 +0100 |
---|---|---|
committer | Markus Heiser <markus.heiser@darmarIT.de> | 2024-11-28 06:05:45 +0100 |
commit | 7b6b772e3485c60c4c1a3abda8d7bd862ea9d858 (patch) | |
tree | c46a90c56328d5ecd902414cd710dee0e86873e6 | |
parent | 342d321196a84437d51c75da348c533e01626361 (diff) | |
download | searxng-7b6b772e3485c60c4c1a3abda8d7bd862ea9d858.tar.gz searxng-7b6b772e3485c60c4c1a3abda8d7bd862ea9d858.zip |
[fix] wikicommons engine: remove HTML tags from result items
BTW: humanize filesize (Bytes) to KB, MB, GB ..
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
-rw-r--r-- | searx/engines/wikicommons.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/searx/engines/wikicommons.py b/searx/engines/wikicommons.py index a229d24b6..214881bed 100644 --- a/searx/engines/wikicommons.py +++ b/searx/engines/wikicommons.py @@ -7,6 +7,8 @@ import datetime from urllib.parse import urlencode +from searx.utils import html_to_text, humanize_bytes + # about about = { "website": 'https://commons.wikimedia.org/', @@ -74,7 +76,7 @@ def response(resp): result = { 'url': imageinfo["descriptionurl"], 'title': title, - 'content': item["snippet"], + 'content': html_to_text(item["snippet"]), } if search_type == "images": @@ -93,7 +95,7 @@ def response(resp): elif search_type == "files": result['template'] = 'files.html' result['metadata'] = imageinfo['mime'] - result['size'] = imageinfo['size'] + result['size'] = humanize_bytes(imageinfo['size']) elif search_type == "audio": result['iframe_src'] = imageinfo['url'] |