[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

@ -5,7 +5,7 @@
from urllib.parse import urljoin
from lxml import html
from searx.utils import extract_text, get_torrent_size
from searx.utils import extract_text
# about
about = {
@ -45,7 +45,7 @@ def response(resp):
title = extract_text(result.xpath('.//a[@title]'))
content = extract_text(result.xpath('.//div[@class="files"]'))
files_data = extract_text(result.xpath('.//div[@class="tail"]')).split()
filesize = get_torrent_size(files_data[FILESIZE], files_data[FILESIZE_MULTIPLIER])
filesize = f"{files_data[FILESIZE]} {files_data[FILESIZE_MULTIPLIER]}"
magnetlink = result.xpath('.//div[@class="tail"]//a[@class="title"]/@href')[0]
results.append(