Commit 55926142 authored by echel0n's avatar echel0n

Fixed login issues for Speed.cd torrent provider.

parent 8e662ef3
# Changelog
- * 817bd5d - 2018-12-04: Release v9.4.48
- * 36ba505 - 2018-12-08: Fixed login issues for Speed.cd torrent provider.
- * 5663214 - 2018-12-04: Release v9.4.48
- * e0fd191 - 2018-12-04: Cleaned up mass edit view code. Fixed bug with comparing minseed and minleech values.
- * b55a806 - 2018-12-02: Pre-Release v9.4.48.dev9
- * ade442d - 2018-12-02: Upgraded to Tornado 5.1.1 Refactored IOLoop placement.
......
......@@ -20,6 +20,8 @@ from __future__ import unicode_literals
from urlparse import urljoin
from requests.utils import dict_from_cookiejar
import sickrage
from sickrage.core.caches.tv_cache import TVCache
from sickrage.core.helpers import bs4_parser, try_int, convert_size
......@@ -35,47 +37,47 @@ class SpeedCDProvider(TorrentProvider):
'search': '{base_url}/browse.php'.format(**self.urls),
})
# self.username = None
# self.password = None
self.username = None
self.password = None
self.freeleech = False
self.minseed = None
self.minleech = None
self.enable_cookies = True
self.required_cookies = ('inSpeed_uid', 'inSpeed_speedian')
# self.enable_cookies = True
# self.required_cookies = ('inSpeed_uid', 'inSpeed_speedian')
self.proper_strings = ['PROPER', 'REPACK', 'REAL', 'RERIP']
self.cache = TVCache(self, min_time=20)
# def login(self):
# return self.cookie_login('log in')
def login(self):
return self.cookie_login('log in')
if any(dict_from_cookiejar(self.session.cookies).values()):
return True
# def login(self):
# if any(dict_from_cookiejar(self.session.cookies).values()):
# return True
#
# login_params = {
# 'username': self.username,
# 'password': self.password
# }
#
# try:
# with bs4_parser(self.session.get(self.urls['login']).text) as html:
# login_url = urljoin(self.urls['base_url'], html.find('form', id='loginform').get('action'))
# response = self.session.post(login_url, data=login_params, timeout=30).text
# except Exception:
# sickrage.app.log.warning("Unable to connect to provider")
# self.session.cookies.clear()
# return False
#
# if 'logout.php' not in response.lower():
# sickrage.app.log.warning("Invalid username or password, check your settings.")
# self.session.cookies.clear()
# return False
#
# return True
login_params = {
'username': self.username,
'password': self.password
}
try:
with bs4_parser(self.session.get(self.urls['login']).text) as html:
login_url = urljoin(self.urls['base_url'], html.find('form', id='loginform').get('action'))
response = self.session.post(login_url, data=login_params, timeout=30).text
except Exception:
sickrage.app.log.warning("Unable to connect to provider")
self.session.cookies.clear()
return False
if 'logout.php' not in response.lower():
sickrage.app.log.warning("Invalid username or password, check your settings.")
self.session.cookies.clear()
return False
return True
def search(self, search_strings, age=0, ep_obj=None, **kwargs):
results = []
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment