Private GIT

Skip to content
Snippets Groups Projects
Commit 9b2acb13 authored by Yoann Laissus's avatar Yoann Laissus Committed by miigotu
Browse files

YggTorrent : Fix for session expiration (very short)

parent 2205616b
Branches
No related tags found
No related merge requests found
......@@ -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 []
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment