From daaa2154e578b451cd22284e93811a0586cd22f5 Mon Sep 17 00:00:00 2001 From: Ruud Date: Tue, 20 Nov 2012 21:07:21 +0100 Subject: [PATCH] Return when no table is returned. fix #1053 --- couchpotato/core/providers/torrent/thepiratebay/main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/couchpotato/core/providers/torrent/thepiratebay/main.py b/couchpotato/core/providers/torrent/thepiratebay/main.py index a4ce3631..29a8c8ef 100644 --- a/couchpotato/core/providers/torrent/thepiratebay/main.py +++ b/couchpotato/core/providers/torrent/thepiratebay/main.py @@ -57,7 +57,7 @@ class ThePirateBay(TorrentProvider): data = '' try: - data = self.urlopen(proxy, timeout = 3) + data = self.urlopen(proxy, timeout = 3, show_error = False) except: log.debug('Failed tpb proxy %s', proxy) @@ -88,6 +88,10 @@ class ThePirateBay(TorrentProvider): try: soup = BeautifulSoup(data) results_table = soup.find('table', attrs = {'id': 'searchResult'}) + + if not results_table: + return results + entries = results_table.find_all('tr') for result in entries[1:]: link = result.find(href = re.compile('torrent\/\d+\/'))