From 9b2acb13e7b66fe95bde68a6cbca618b336c4c45 Mon Sep 17 00:00:00 2001 From: Yoann Laissus <yoann.laissus@gmail.com> Date: Thu, 10 May 2018 17:09:05 +0200 Subject: [PATCH] YggTorrent : Fix for session expiration (very short) --- sickbeard/providers/yggtorrent.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sickbeard/providers/yggtorrent.py b/sickbeard/providers/yggtorrent.py index 4ad93fe4c..a25c18abb 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 [] -- GitLab