Return when no table is returned. fix #1053
This commit is contained in:
@@ -57,7 +57,7 @@ class ThePirateBay(TorrentProvider):
|
|||||||
|
|
||||||
data = ''
|
data = ''
|
||||||
try:
|
try:
|
||||||
data = self.urlopen(proxy, timeout = 3)
|
data = self.urlopen(proxy, timeout = 3, show_error = False)
|
||||||
except:
|
except:
|
||||||
log.debug('Failed tpb proxy %s', proxy)
|
log.debug('Failed tpb proxy %s', proxy)
|
||||||
|
|
||||||
@@ -88,6 +88,10 @@ class ThePirateBay(TorrentProvider):
|
|||||||
try:
|
try:
|
||||||
soup = BeautifulSoup(data)
|
soup = BeautifulSoup(data)
|
||||||
results_table = soup.find('table', attrs = {'id': 'searchResult'})
|
results_table = soup.find('table', attrs = {'id': 'searchResult'})
|
||||||
|
|
||||||
|
if not results_table:
|
||||||
|
return results
|
||||||
|
|
||||||
entries = results_table.find_all('tr')
|
entries = results_table.find_all('tr')
|
||||||
for result in entries[1:]:
|
for result in entries[1:]:
|
||||||
link = result.find(href = re.compile('torrent\/\d+\/'))
|
link = result.find(href = re.compile('torrent\/\d+\/'))
|
||||||
|
|||||||
Reference in New Issue
Block a user