Browse Source

Change add warning to logs for enabled providers where `cf_clearance` cookie is missing.

tags/release_0.21.47^2
JackDandy 5 years ago
parent
commit
804834af10
  1. 7
      CHANGES.md
  2. 27
      sickbeard/providers/generic.py
  3. 6
      sickbeard/providers/ptf.py
  4. 6
      sickbeard/providers/scenetime.py
  5. 6
      sickbeard/providers/torrentday.py
  6. 5
      sickbeard/providers/torrentleech.py
  7. 5
      sickbeard/rssfeeds.py

7
CHANGES.md

@ -1,4 +1,9 @@
### 0.21.46 (2020-09-16 20:00:00 UTC)
### 0.21.47 (2020-09-xx xx:xx:00 UTC)
* Change add warning to logs for enabled providers where `cf_clearance` cookie is missing
### 0.21.46 (2020-09-16 20:00:00 UTC)
* Fix TorrentDay and IPTorrents. Important: user must add browser cookie `cf_clearance` to provider 'Cookies' setting.
If `cf_clearance` not found in browser, log out, delete site cookies, refresh browser, `cf_clearance` will be created.

27
sickbeard/providers/generic.py

@ -1291,21 +1291,36 @@ class GenericProvider(object):
cookies = self.cookies
if not (cookies and re.match(r'^(?:\w+=[^;\s]+[;\s]*)+$', cookies)):
return False
return False, None
if self.enabled:
ui_string_method = getattr(self, 'ui_string', None)
if callable(ui_string_method):
pid = self.get_id()
# `cookie_str_only` prevents circular call via _valid_home() in ui_string_method
key = ('%s_digest' % pid, 'cookie_str_only')[
pid in ('ptfiles', 'scenetime', 'torrentday', 'torrentleech')]
reqd = 'cf_clearance'
if reqd in ui_string_method(key) and reqd not in cookies:
return False, \
u'%(p)s Cookies setting require %(r)s. If %(r)s not found in browser, log out,' \
u' delete site cookies, refresh browser, %(r)s should be created' % \
dict(p=self.name, r='\'%s\'' % reqd)
cj = requests.utils.add_dict_to_cookiejar(self.session.cookies,
dict([x.strip().split('=') for x in cookies.split(';')
if '' != x])),
for item in cj:
if not isinstance(item, requests.cookies.RequestsCookieJar):
return False
return False, None
return True
return True, None
def _check_cookie(self):
if self.check_auth_cookie():
return True, None
success, err_msg = self.check_auth_cookie()
if success or (not success and err_msg):
return success, err_msg
return False, 'Cookies not correctly formatted key=value pairs e.g. uid=xx;pass=yy)'
@ -1789,7 +1804,7 @@ class TorrentProvider(GenericProvider):
success, msg = self._check_cookie()
if not success:
self.cookies = None
logger.log(u'%s: [%s]' % (msg, self.cookies), logger.WARNING)
logger.log(u'%s' % msg, logger.WARNING)
return
url_base = getattr(self, 'url_base', None)

6
sickbeard/providers/ptf.py

@ -154,10 +154,12 @@ class PTFProvider(generic.TorrentProvider):
return results
def ui_string(self, key):
cookies = 'use... \'session_key=xx\''
if 'cookie_str_only' == key:
return cookies
if 'ptfiles_digest' == key and self._valid_home():
current_url = getattr(self, 'urls', {}).get('config_provider_home_uri')
return ('use... \'session_key=xx\'' +
(current_url and (' from a session logged in at <a target="_blank" href="%s">%s</a>' %
return (cookies + (current_url and (' from a session logged in at <a target="_blank" href="%s">%s</a>' %
(anon_url(current_url), current_url.strip('/'))) or ''))
return ''

6
sickbeard/providers/scenetime.py

@ -160,10 +160,12 @@ class SceneTimeProvider(generic.TorrentProvider):
return results
def ui_string(self, key):
cookies = 'use... \'uid=xx; pass=yy\''
if 'cookie_str_only' == key:
return cookies
if 'scenetime_digest' == key and self._valid_home():
current_url = getattr(self, 'urls', {}).get('config_provider_home_uri')
return ('use... \'uid=xx; pass=yy\'' +
(current_url and (' from a session logged in at <a target="_blank" href="%s">%s</a>' %
return (cookies + (current_url and (' from a session logged in at <a target="_blank" href="%s">%s</a>' %
(anon_url(current_url), current_url.strip('/'))) or ''))
return ''

6
sickbeard/providers/torrentday.py

@ -165,10 +165,12 @@ class TorrentDayProvider(generic.TorrentProvider):
return super(TorrentDayProvider, self)._episode_strings(ep_obj, sep_date='.', date_or=True, **kwargs)
def ui_string(self, key):
cookies = 'use... \'uid=xx; pass=yy; cf_clearance=zz\''
if 'cookie_str_only' == key:
return cookies
if 'torrentday_digest' == key and self._valid_home():
current_url = getattr(self, 'urls', {}).get('config_provider_home_uri')
return ('use... \'uid=xx; pass=yy; cf_clearance=zz\'' +
(current_url and ('<br>from a session logged in at <a target="_blank" href="%s">%s</a>' %
return (cookies + (current_url and ('<br>from a session logged in at <a target="_blank" href="%s">%s</a>' %
(anon_url(current_url), current_url.strip('/'))) or ''))
return ''

5
sickbeard/providers/torrentleech.py

@ -150,7 +150,10 @@ class TorrentLeechProvider(generic.TorrentProvider):
return super(TorrentLeechProvider, self)._episode_strings(ep_obj, sep_date='|', **kwargs)
def ui_string(self, key):
return 'torrentleech_digest' == key and self._valid_home() and 'use... \'tluid=xx; tlpass=yy\'' or ''
cookies = 'use... \'tluid=xx; tlpass=yy\''
if 'cookie_str_only' == key:
return cookies
return 'torrentleech_digest' == key and self._valid_home() and cookies or ''
provider = TorrentLeechProvider()

5
sickbeard/rssfeeds.py

@ -15,7 +15,10 @@ class RSSFeeds(object):
def get_feed(self, url, **kwargs):
if self.provider and self.provider.check_auth_cookie():
if self.provider:
success, err_msg = self.provider.check_auth_cookie()
if not success:
return
response = self.provider.get_url(url, **kwargs)
if not self.provider.should_skip() and response:
try:

Loading…
Cancel
Save