Commit 45d0b32d authored by echel0n's avatar echel0n
Browse files

Switch TorrentLeech provider to login via cookies due to reCAPTCHA

parent 2f40c76d
# Changelog
- * 63b24b5 - 2018-08-22: Pre-Release v9.3.58.dev1
- * 6f070ab - 2018-08-23: Switch TorrentLeech provider to login via cookies due to reCAPTCHA
- * 2f40c76 - 2018-08-22: Pre-Release v9.3.58.dev1
- * 9010755 - 2018-08-22: Fixed issue #256 - unable to search BTN
- * 5f0e3bf - 2018-08-20: Fixed issue #253 - Provider Option Missing Cookie Field
- * e5b5706 - 2018-08-19: Release v9.3.57
......
......@@ -20,8 +20,6 @@ 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, convert_size, try_int
......@@ -33,13 +31,16 @@ class TorrentLeechProvider(TorrentProvider):
super(TorrentLeechProvider, self).__init__("TorrentLeech", 'https://www.torrentleech.org', True)
self.urls.update({
'login': '{base_url}/user/account/login/'.format(**self.urls),
'login': '{base_url}/user/account/login'.format(**self.urls),
'search': '{base_url}/torrents/browse'.format(**self.urls),
})
self.username = None
self.password = None
self.enable_cookies = True
self.required_cookies = ('tluid', 'tlpass')
self.minseed = None
self.minleech = None
......@@ -48,28 +49,31 @@ class TorrentLeechProvider(TorrentProvider):
self.cache = TVCache(self, min_time=20)
def login(self):
cookies = dict_from_cookiejar(self.session.cookies)
if any(cookies.values()) and cookies.get('member_id'):
return True
login_params = {
'username': self.username,
'password': self.password,
'login': 'submit',
'remember_me': 'on',
}
try:
response = self.session.post(self.urls['login'], data=login_params, timeout=30).text
except Exception:
sickrage.app.log.warning("Unable to connect to provider")
return False
if '<title>Login :: TorrentLeech.org</title>' in response:
sickrage.app.log.warning("Invalid username or password. Check your settings")
return False
return True
return self.cookie_login('log in')
# def login(self):
# cookies = dict_from_cookiejar(self.session.cookies)
# if any(cookies.values()) and cookies.get('member_id'):
# return True
#
# login_params = {
# 'username': self.username,
# 'password': self.password,
# 'login': 'submit',
# 'remember_me': 'on',
# }
#
# try:
# response = self.session.post(self.urls['login'], data=login_params, timeout=30).text
# except Exception:
# sickrage.app.log.warning("Unable to connect to provider")
# return False
#
# if '<title>Login :: TorrentLeech.org</title>' in response:
# sickrage.app.log.warning("Invalid username or password. Check your settings")
# return False
#
# return True
def search(self, search_strings, age=0, ep_obj=None, **kwargs):
results = []
......
Supports Markdown
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