summaryrefslogtreecommitdiff
path: root/searx/engines/btdigg.py
diff options
context:
space:
mode:
authorNoemi Vanyi <sitbackandwait@gmail.com>2016-08-13 14:55:47 +0200
committerNoemi Vanyi <sitbackandwait@gmail.com>2016-08-13 16:19:00 +0200
commit3a1c5876b16a51f64505c119283447b06f2a3d99 (patch)
treef2a453fb952224629a91e6fc0de03e80a0c45826 /searx/engines/btdigg.py
parent104cdb7d03771d4eca5b5126532ccf47642bb9de (diff)
downloadsearxng-3a1c5876b16a51f64505c119283447b06f2a3d99.tar.gz
searxng-3a1c5876b16a51f64505c119283447b06f2a3d99.zip
add digbt engine
Unfortunately, it is quite slow so it is disabled. Furthermore, the display of number of files is wrong on digbt.org, so it is not displayed on searx.
Diffstat (limited to 'searx/engines/btdigg.py')
-rw-r--r--searx/engines/btdigg.py16
1 files changed, 2 insertions, 14 deletions
diff --git a/searx/engines/btdigg.py b/searx/engines/btdigg.py
index c2b22f003..ea6baf1c8 100644
--- a/searx/engines/btdigg.py
+++ b/searx/engines/btdigg.py
@@ -16,6 +16,7 @@ from urllib import quote
from lxml import html
from operator import itemgetter
from searx.engines.xpath import extract_text
+from searx.utils import get_torrent_size
# engine dependent config
categories = ['videos', 'music', 'files']
@@ -68,20 +69,7 @@ def response(resp):
leech = 0
# convert filesize to byte if possible
- try:
- filesize = float(filesize)
-
- # convert filesize to byte
- if filesize_multiplier == 'TB':
- filesize = int(filesize * 1024 * 1024 * 1024 * 1024)
- elif filesize_multiplier == 'GB':
- filesize = int(filesize * 1024 * 1024 * 1024)
- elif filesize_multiplier == 'MB':
- filesize = int(filesize * 1024 * 1024)
- elif filesize_multiplier == 'KB':
- filesize = int(filesize * 1024)
- except:
- filesize = None
+ filesize = get_torrent_size(filesize, filesize_multiplier)
# convert files to int if possible
if files.isdigit():