Browse Source

update rutor.py: added magnet links

master
imDMG 2 years ago
parent
commit
c456af4120
  1. 2
      README.md
  2. 25
      engines/rutor.py

2
README.md

@ -4,7 +4,7 @@
## Rutracker.org ![v1.7](https://img.shields.io/badge/v1.7-blue) ## Rutracker.org ![v1.7](https://img.shields.io/badge/v1.7-blue)
Biggest russian torrent tracker. Biggest russian torrent tracker.
## Rutor.org ![v1.5](https://img.shields.io/badge/v1.5-blue) ## Rutor.org ![v1.6](https://img.shields.io/badge/v1.6-blue)
Popular free russian torrent tracker. Popular free russian torrent tracker.
## Kinozal.tv ![v2.10](https://img.shields.io/badge/v2.10-blue) ## Kinozal.tv ![v2.10](https://img.shields.io/badge/v2.10-blue)

25
engines/rutor.py

@ -1,4 +1,4 @@
# VERSION: 1.5 # VERSION: 1.6
# AUTHORS: imDMG [imdmgg@gmail.com] # AUTHORS: imDMG [imdmgg@gmail.com]
# Rutor.org search engine plugin for qBittorrent # Rutor.org search engine plugin for qBittorrent
@ -28,8 +28,8 @@ except ImportError:
FILE = Path(__file__) FILE = Path(__file__)
BASEDIR = FILE.parent.absolute() BASEDIR = FILE.parent.absolute()
FILENAME = FILE.name[:-3] FILENAME = FILE.stem
FILE_J, FILE_C = [BASEDIR / (FILENAME + fl) for fl in [".json", ".cookie"]] FILE_J, FILE_C = [BASEDIR / (FILENAME + fl) for fl in (".json", ".cookie")]
PAGES = 100 PAGES = 100
@ -39,8 +39,9 @@ def rng(t: int) -> range:
RE_TORRENTS = re.compile( RE_TORRENTS = re.compile(
r'(?:gai|tum)"><td>(.+?)</td.+?href="/(torrent/(\d+).+?)">(.+?)</a.+?right"' r'(?:gai|tum)"><td>(.+?)</td.+?href="(magnet:.+?)".+?href="/'
r'>([.\d]+&nbsp;\w+)</td.+?alt="S"\s/>(.+?)</s.+?red">(.+?)</s', re.S r'(torrent/(\d+).+?)">(.+?)</a.+?right">([.\d]+?&nbsp;\w+?)</td.+?alt="S"\s'
r'/>(.+?)</s.+?red">(.+?)</s', re.S
) )
RE_RESULTS = re.compile(r"</b>\sРезультатов\sпоиска\s(\d{1,4})\s", re.S) RE_RESULTS = re.compile(r"</b>\sРезультатов\sпоиска\s(\d{1,4})\s", re.S)
PATTERNS = ("%ssearch/%i/%i/000/0/%s",) PATTERNS = ("%ssearch/%i/%i/000/0/%s",)
@ -80,7 +81,7 @@ class Config:
# username: str = "USERNAME" # username: str = "USERNAME"
# password: str = "PASSWORD" # password: str = "PASSWORD"
torrent_date: bool = True torrent_date: bool = True
# magnet: bool = False magnet: bool = False
proxy: bool = False proxy: bool = False
# dynamic_proxy: bool = True # dynamic_proxy: bool = True
proxies: dict = field(default_factory=lambda: {"http": "", "https": ""}) proxies: dict = field(default_factory=lambda: {"http": "", "https": ""})
@ -226,12 +227,12 @@ class Rutor:
prettyPrinter({ prettyPrinter({
"engine_url": self.url, "engine_url": self.url,
"desc_link": self.url + tor[1], "desc_link": self.url + tor[2],
"name": torrent_date + unescape(tor[3]), "name": torrent_date + unescape(tor[4]),
"link": self.url_dl + tor[2], "link": tor[1] if config.magnet else self.url_dl + tor[3],
"size": unescape(tor[4]), "size": unescape(tor[5]),
"seeds": unescape(tor[5]), "seeds": unescape(tor[6]),
"leech": unescape(tor[6]) "leech": unescape(tor[7])
}) })
def _request( def _request(

Loading…
Cancel
Save