diff --git a/sickbeard/providers/yggtorrent.py b/sickbeard/providers/yggtorrent.py index 4ad93fe4cd9ad1f0634bb656930dc88e4a0f486a..a25c18abbeb5c32e0ed4e6f711937b37177b43ca 100644 --- a/sickbeard/providers/yggtorrent.py +++ b/sickbeard/providers/yggtorrent.py @@ -61,9 +61,6 @@ class YggTorrentProvider(TorrentProvider): # pylint: disable=too-many-instance- self.cache = tvcache.TVCache(self, min_time=30) def login(self): - if any(dict_from_cookiejar(self.session.cookies).values()): - return True - login_params = { 'id': self.username, 'pass': self.password, @@ -90,8 +87,6 @@ class YggTorrentProvider(TorrentProvider): # pylint: disable=too-many-instance- def search(self, search_strings, age=0, ep_obj=None): # pylint: disable=too-many-locals, too-many-branches results = [] - if not self.login(): - return results for mode in search_strings: items = [] @@ -126,6 +121,10 @@ class YggTorrentProvider(TorrentProvider): # pylint: disable=too-many-instance- if not data: continue + if 'logout' not in data: + logger.log('Refreshing cookies', logger.DEBUG) + self.login() + with BS4Parser(data, 'html5lib') as html: torrent_table = html.find(class_='table') torrent_rows = torrent_table('tr') if torrent_table else []