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 @@ @@ -4,7 +4,7 @@
## Rutracker.org ![v1.7](https://img.shields.io/badge/v1.7-blue)
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.
## Kinozal.tv ![v2.10](https://img.shields.io/badge/v2.10-blue)

25
engines/rutor.py

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

Loading…
Cancel
Save