diff options
author | Bnyro <bnyro@tutanota.com> | 2024-06-12 22:35:13 +0200 |
---|---|---|
committer | Markus Heiser <markus.heiser@darmarIT.de> | 2024-06-15 15:42:29 +0200 |
commit | e9f8412a6e4b399a3335da73b3d321104bb0c4fb (patch) | |
tree | 0caf5c1bede7bb8739c5c2e5d107fa75455ecc24 /searx/engines/btdigg.py | |
parent | 16ce5612dd0ef426b6851ab97b248595f3933d8f (diff) | |
download | searxng-e9f8412a6e4b399a3335da73b3d321104bb0c4fb.tar.gz searxng-e9f8412a6e4b399a3335da73b3d321104bb0c4fb.zip |
[perf] torrents.html, files.html: don't parse and re-format filesize
Diffstat (limited to 'searx/engines/btdigg.py')
-rw-r--r-- | searx/engines/btdigg.py | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/searx/engines/btdigg.py b/searx/engines/btdigg.py index 588d62093..193785182 100644 --- a/searx/engines/btdigg.py +++ b/searx/engines/btdigg.py @@ -6,7 +6,7 @@ from urllib.parse import quote, urljoin from lxml import html -from searx.utils import extract_text, get_torrent_size +from searx.utils import extract_text # about about = { @@ -58,13 +58,9 @@ def response(resp): content = content.strip().replace('\n', ' | ') content = ' '.join(content.split()) - filesize = result.xpath('.//span[@class="torrent_size"]/text()')[0].split()[0] - filesize_multiplier = result.xpath('.//span[@class="torrent_size"]/text()')[0].split()[1] + filesize = result.xpath('.//span[@class="torrent_size"]/text()')[0] files = (result.xpath('.//span[@class="torrent_files"]/text()') or ['1'])[0] - # convert filesize to byte if possible - filesize = get_torrent_size(filesize, filesize_multiplier) - # convert files to int if possible try: files = int(files) |