From 2313c3981f0eb2a2adbdafd73e2b4f668945fabf Mon Sep 17 00:00:00 2001 From: kor-dian Date: Wed, 8 Jan 2014 21:59:34 +0100 Subject: [PATCH] Update search.py added a search in a PirateBay proxy, because the original site is blocked by many ISPs, the postfix /0/7/0 in url gives sorting by number of seeds could you verify if it works? and add it to official release that's the only thing my openelec misses --- resources/lib/search.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/resources/lib/search.py b/resources/lib/search.py index 6ab67e2..9dbc7f1 100644 --- a/resources/lib/search.py +++ b/resources/lib/search.py @@ -50,6 +50,28 @@ class TPB(Search): 'leechers': leechers, }) return torrents +class TPBproxy(Search): + def __init__(self): + self.search_uri = 'http://pirateproxy.net/search/%s/0/7/0' + def search(self, terms): + torrents = [] + url = self.search_uri % '+'.join(terms.split(' ')) + f = urlopen(url) + soup = BeautifulSoup(f.read()) + for details in soup.findAll('a', {'class': 'detLink'}): + name = details.text + url = details.findNext('a', {'href': re.compile('^magnet:')})['href'] + td = details.findNext('td') + seeds = int(td.text) + td = td.findNext('td') + leechers = int(td.text) + torrents.append({ + 'url': url, + 'name': name, + 'seeds': seeds, + 'leechers': leechers, + }) + return torrents class TorrentReactor(Search): def __init__(self): self.search_uri = 'http://www.torrentreactor.net/rss.php?search=%s'