|
|
@ -15,7 +15,7 @@ class ThePirateBay(TorrentMagnetProvider): |
|
|
|
|
|
|
|
urls = { |
|
|
|
'detail': '%s/torrent/%s', |
|
|
|
'search': '%s/search/%s/0/7/%d' |
|
|
|
'search': '%s/search/%s/%s/7/%d' |
|
|
|
} |
|
|
|
|
|
|
|
cat_ids = [ |
|
|
@ -45,7 +45,12 @@ class ThePirateBay(TorrentMagnetProvider): |
|
|
|
|
|
|
|
def _searchOnTitle(self, title, movie, quality, results): |
|
|
|
|
|
|
|
search_url = self.urls['search'] % (self.getDomain(), tryUrlencode(title + ' ' + quality['identifier']), self.getCatId(quality['identifier'])[0]) |
|
|
|
page = 0 |
|
|
|
total_pages = 1 |
|
|
|
|
|
|
|
while page < total_pages: |
|
|
|
|
|
|
|
search_url = self.urls['search'] % (self.getDomain(), tryUrlencode('"%s %s"' % (title, movie['library']['year'])), page, self.getCatId(quality['identifier'])[0]) |
|
|
|
|
|
|
|
data = self.getHTMLData(search_url) |
|
|
|
|
|
|
@ -57,6 +62,14 @@ class ThePirateBay(TorrentMagnetProvider): |
|
|
|
if not results_table: |
|
|
|
return |
|
|
|
|
|
|
|
try: |
|
|
|
total_pages = len(soup.find('div', attrs = {'align': 'center'}).find_all('a')) |
|
|
|
page += 1 |
|
|
|
except: |
|
|
|
pass |
|
|
|
|
|
|
|
print total_pages, page |
|
|
|
|
|
|
|
entries = results_table.find_all('tr') |
|
|
|
for result in entries[2:]: |
|
|
|
link = result.find(href = re.compile('torrent\/\d+\/')) |
|
|
@ -92,6 +105,7 @@ class ThePirateBay(TorrentMagnetProvider): |
|
|
|
except: |
|
|
|
log.error('Failed getting results from %s: %s', (self.getName(), traceback.format_exc())) |
|
|
|
|
|
|
|
|
|
|
|
def isEnabled(self): |
|
|
|
return super(ThePirateBay, self).isEnabled() and self.getDomain() |
|
|
|
|
|
|
|