[perf] torrents.html, files.html: don't parse and re-format filesize

This commit is contained in:
Bnyro 2024-06-12 22:35:13 +02:00 committed by Markus Heiser
parent 16ce5612dd
commit e9f8412a6e
13 changed files with 23 additions and 86 deletions

View file

@ -9,7 +9,6 @@ from lxml import html
from searx.utils import (
eval_xpath_getindex,
extract_text,
get_torrent_size,
int_or_zero,
)
@ -99,11 +98,7 @@ def response(resp):
# let's try to calculate the torrent size
filesize = None
filesize_info = eval_xpath_getindex(result, xpath_filesize, 0, '')
if filesize_info:
filesize_info = result.xpath(xpath_filesize)[0]
filesize = get_torrent_size(*filesize_info.split())
filesize = eval_xpath_getindex(result, xpath_filesize, 0, '')
# content string contains all information not included into template
content = 'Category: "{category}". Downloaded {downloads} times.'