diff options
| author | misnyo <misnyo@misnyo.eu> | 2017-09-04 20:05:04 +0200 |
|---|---|---|
| committer | misnyo <misnyo@misnyo.eu> | 2017-09-04 20:05:04 +0200 |
| commit | 33fd938016def4496876d89d0ccaa53f47705005 (patch) | |
| tree | be751691b517a3f43ced554515f9131becfdb187 /searx/engines/tokyotoshokan.py | |
| parent | c3232b0e1a82315e5936fb3c0731548efd66a0b3 (diff) | |
[mod] int_or_zero refactored to searx_utils
Diffstat (limited to 'searx/engines/tokyotoshokan.py')
| -rw-r--r-- | searx/engines/tokyotoshokan.py | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/searx/engines/tokyotoshokan.py b/searx/engines/tokyotoshokan.py index dfd2e7790..773212043 100644 --- a/searx/engines/tokyotoshokan.py +++ b/searx/engines/tokyotoshokan.py @@ -15,7 +15,7 @@ from lxml import html from searx.engines.xpath import extract_text from datetime import datetime from searx.url_utils import urlencode -from searx.utils import get_torrent_size +from searx.utils import get_torrent_size, int_or_zero # engine dependent config categories = ['files', 'videos', 'music'] @@ -26,17 +26,6 @@ base_url = 'https://www.tokyotosho.info/' search_url = base_url + 'search.php?{query}' -# convert a variable to integer or return 0 if it's not a number -def int_or_zero(num): - if isinstance(num, list): - if len(num) < 1: - return 0 - num = num[0] - if num.isdigit(): - return int(num) - return 0 - - # do search-request def request(query, params): query = urlencode({'page': params['pageno'], 'terms': query}) |