Browse Source

quote request

master
imDMG 1 year ago
parent
commit
bc0f1eaa15
  1. 24
      engines/kinozal.py
  2. 6
      engines/nnmclub.py
  3. 6
      engines/rutor.py
  4. 6
      engines/rutracker.py

24
engines/kinozal.py

@ -1,4 +1,4 @@
# VERSION: 2.11 # VERSION: 2.12
# AUTHORS: imDMG [imdmgg@gmail.com] # AUTHORS: imDMG [imdmgg@gmail.com]
# Kinozal.tv search engine plugin for qBittorrent # Kinozal.tv search engine plugin for qBittorrent
@ -19,7 +19,7 @@ from pathlib import Path
from tempfile import NamedTemporaryFile from tempfile import NamedTemporaryFile
from typing import Callable from typing import Callable
from urllib.error import URLError, HTTPError from urllib.error import URLError, HTTPError
from urllib.parse import urlencode, unquote from urllib.parse import urlencode, unquote, quote
from urllib.request import build_opener, HTTPCookieProcessor, ProxyHandler from urllib.request import build_opener, HTTPCookieProcessor, ProxyHandler
try: try:
@ -28,15 +28,6 @@ except ImportError:
sys.path.insert(0, str(Path(__file__).parent.parent.absolute())) sys.path.insert(0, str(Path(__file__).parent.parent.absolute()))
from novaprinter import prettyPrinter from novaprinter import prettyPrinter
# setup logging
logging.basicConfig(
format="%(asctime)s %(name)-12s %(levelname)-8s %(message)s",
datefmt="%m-%d %H:%M",
level=logging.DEBUG
)
logger = logging.getLogger(__name__)
FILE = Path(__file__) FILE = Path(__file__)
BASEDIR = FILE.parent.absolute() BASEDIR = FILE.parent.absolute()
@ -76,6 +67,15 @@ ICON = ("AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAQAQAAAAAAAAAAA"
"gEc7/4BHO/+ARztMAAAAAIBHO0yARzv/gEc7/4BHO0wAAAAACCEAAAABAAAAAQAAAAEAAI" "gEc7/4BHO/+ARztMAAAAAIBHO0yARzv/gEc7/4BHO0wAAAAACCEAAAABAAAAAQAAAAEAAI"
"ADAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAACAAwAAAAEAAAABAAAAAQAACCEAAA== ") "ADAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAACAAwAAAAEAAAABAAAAAQAACCEAAA== ")
# setup logging
logging.basicConfig(
format="%(asctime)s %(name)-12s %(levelname)-8s %(message)s",
datefmt="%m-%d %H:%M",
level=logging.DEBUG
)
logger = logging.getLogger(__name__)
def rng(t: int) -> range: def rng(t: int) -> range:
return range(1, -(-t // PAGES)) return range(1, -(-t // PAGES))
@ -261,7 +261,7 @@ class Kinozal:
self.login() self.login()
def _search(self, what: str, cat: str = "all") -> None: def _search(self, what: str, cat: str = "all") -> None:
query = PATTERNS[0] % (self.url, what.replace(" ", "+"), query = PATTERNS[0] % (self.url, quote(unquote(what)),
self.supported_categories[cat]) self.supported_categories[cat])
# make first request (maybe it enough) # make first request (maybe it enough)

6
engines/nnmclub.py

@ -1,4 +1,4 @@
# VERSION: 2.10 # VERSION: 2.12
# AUTHORS: imDMG [imdmgg@gmail.com] # AUTHORS: imDMG [imdmgg@gmail.com]
# NoNaMe-Club search engine plugin for qBittorrent # NoNaMe-Club search engine plugin for qBittorrent
@ -17,7 +17,7 @@ from pathlib import Path
from tempfile import NamedTemporaryFile from tempfile import NamedTemporaryFile
from typing import Callable from typing import Callable
from urllib.error import URLError, HTTPError from urllib.error import URLError, HTTPError
from urllib.parse import urlencode, unquote from urllib.parse import urlencode, unquote, quote
from urllib.request import build_opener, HTTPCookieProcessor, ProxyHandler from urllib.request import build_opener, HTTPCookieProcessor, ProxyHandler
try: try:
@ -252,7 +252,7 @@ class NNMClub:
def _search(self, what: str, cat: str = "all") -> None: def _search(self, what: str, cat: str = "all") -> None:
c = self.supported_categories[cat] c = self.supported_categories[cat]
query = PATTERNS[0] % (self.url, what.replace(" ", "+"), query = PATTERNS[0] % (self.url, quote(unquote(what)),
"f=-1" if c == "-1" else "c=" + c) "f=-1" if c == "-1" else "c=" + c)
# make first request (maybe it enough) # make first request (maybe it enough)

6
engines/rutor.py

@ -1,4 +1,4 @@
# VERSION: 1.7 # VERSION: 1.8
# AUTHORS: imDMG [imdmgg@gmail.com] # AUTHORS: imDMG [imdmgg@gmail.com]
# Rutor.org search engine plugin for qBittorrent # Rutor.org search engine plugin for qBittorrent
@ -16,7 +16,7 @@ from pathlib import Path
from tempfile import NamedTemporaryFile from tempfile import NamedTemporaryFile
from typing import Callable from typing import Callable
from urllib.error import URLError, HTTPError from urllib.error import URLError, HTTPError
from urllib.parse import unquote from urllib.parse import unquote, quote
from urllib.request import build_opener, ProxyHandler from urllib.request import build_opener, ProxyHandler
try: try:
@ -213,7 +213,7 @@ class Rutor:
def _search(self, what: str, cat: str = "all") -> None: def _search(self, what: str, cat: str = "all") -> None:
query = PATTERNS[0] % (self.url, 0, self.supported_categories[cat], query = PATTERNS[0] % (self.url, 0, self.supported_categories[cat],
what.replace(" ", "+")) quote(unquote(what)))
# make first request (maybe it enough) # make first request (maybe it enough)
t0, total = time.time(), self.searching(query, True) t0, total = time.time(), self.searching(query, True)

6
engines/rutracker.py

@ -1,4 +1,4 @@
# VERSION: 1.8 # VERSION: 1.9
# AUTHORS: imDMG [imdmgg@gmail.com] # AUTHORS: imDMG [imdmgg@gmail.com]
# rutracker.org search engine plugin for qBittorrent # rutracker.org search engine plugin for qBittorrent
@ -17,7 +17,7 @@ from pathlib import Path
from tempfile import NamedTemporaryFile from tempfile import NamedTemporaryFile
from typing import Callable from typing import Callable
from urllib.error import URLError, HTTPError from urllib.error import URLError, HTTPError
from urllib.parse import urlencode, unquote from urllib.parse import urlencode, unquote, quote
from urllib.request import build_opener, HTTPCookieProcessor, ProxyHandler from urllib.request import build_opener, HTTPCookieProcessor, ProxyHandler
try: try:
@ -242,7 +242,7 @@ class Rutracker:
self.login() self.login()
def _search(self, what: str, cat: str = "all") -> None: def _search(self, what: str, cat: str = "all") -> None:
query = PATTERNS[0] % (self.url, what.replace(" ", "+"), query = PATTERNS[0] % (self.url, quote(unquote(what)),
self.supported_categories[cat]) self.supported_categories[cat])
# make first request (maybe it enough) # make first request (maybe it enough)

Loading…
Cancel
Save