plugin.video.torrenter3/resources/lib/searchers/rutor.py

23 lines
1.1 KiB
Python
Raw Normal View History

2019-05-04 22:38:06 +03:00
from . import Searcher, urljoin_partial, ResultItem
class SearchEngine(Searcher):
base_url = 'http://new-tor.top'
search_path = '/search/0/0/100/2/{}'
name = 'RuTor.org'
icon = 'searcher_rutor.png'
def process(self, body):
url_constructor = urljoin_partial(self.base_url)
rows = list(filter(lambda x: len(x.findall('.//a')) == 3, body.findall('.//tr')))
for r in rows:
links = r.findall('.//a')
url = url_constructor(links[0].get('href').strip())
title = links[2].text
seeders = int(list(r.findall('.//span[@class="green"]')[0].itertext())[0].strip())
leachers = int(list(r.findall('.//span[@class="red"]')[0].itertext())[0].strip())
size = list(
list(filter(lambda x: len(list(x.itertext())) == 1 and list(x.itertext())[0].strip().endswith(('GB', 'MB')),
r.findall('.//td'))
)[0].itertext()
)[0].strip()
yield ResultItem(url, title, size, seeders, leachers, self.icon, self.cookies, self.base_url)