Updated TPB search to use the new hostname and magnet links

This commit is contained in:
Correl Roush 2012-03-13 19:50:30 -04:00
parent a460bfab97
commit 5c57d1e5fc

View file

@ -30,7 +30,7 @@ class Mininova(Search):
return torrents
class TPB(Search):
def __init__(self):
self.search_uri = 'http://thepiratebay.org/search/%s/'
self.search_uri = 'http://thepiratebay.se/search/%s/'
def search(self, terms):
torrents = []
url = self.search_uri % '+'.join(terms.split(' '))
@ -38,7 +38,7 @@ class TPB(Search):
soup = BeautifulSoup(f.read())
for details in soup.findAll('a', {'class': 'detLink'}):
name = details.text
url = details.findNext('a', {'href': re.compile('^http:\/\/torrents\.thepiratebay\.org\/')})['href']
url = details.findNext('a', {'href': re.compile('^magnet:')})['href']
td = details.findNext('td')
seeds = int(td.text)
td = td.findNext('td')