From 92914726217cbefd768aff3691c4f47c22bf792c Mon Sep 17 00:00:00 2001 From: imDMG Date: Tue, 22 Mar 2022 19:31:05 +0500 Subject: [PATCH] update rutor.py: fix search query --- engines/rutor.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/engines/rutor.py b/engines/rutor.py index c8396c1..c5661a6 100644 --- a/engines/rutor.py +++ b/engines/rutor.py @@ -1,4 +1,4 @@ -# VERSION: 1.4 +# VERSION: 1.5 # AUTHORS: imDMG [imdmgg@gmail.com] # Rutor.org search engine plugin for qBittorrent @@ -140,13 +140,12 @@ class Rutor: "pictures": 3, "books": 11} - def __init__(self): - # error message - self.error = None - - # establish connection - self.session = build_opener() + # error message + error: Optional[str] = None + # establish connection + session = build_opener() + def __init__(self): # add proxy handler if needed if config.proxy: if any(config.proxies.values()): @@ -172,8 +171,8 @@ class Rutor: return None # do async requests if total > PAGES: - query = query.replace("h/0", "h/%i") - qrs = [query % x for x in rng(total)] + query = query.replace("h/0", "h/{}") + qrs = [query.format(x) for x in rng(total)] with ThreadPoolExecutor(len(qrs)) as executor: executor.map(self.searching, qrs, timeout=30)