Browse Source

Fix torrentday

pull/6884/head
Ruud 9 years ago
parent
commit
26d8fd5d19
  1. 35
      couchpotato/core/media/_base/providers/torrent/torrentday.py

35
couchpotato/core/media/_base/providers/torrent/torrentday.py

@ -9,16 +9,24 @@ log = CPLog(__name__)
class Base(TorrentProvider):
urls = {
'test': 'https://torrentday.eu/',
'login': 'https://torrentday.eu/torrents/',
'login_check': 'https://torrentday.eu/userdetails.php',
'detail': 'https://torrentday.eu/details.php?id=%s',
'search': 'https://torrentday.eu/V3/API/API.php',
'download': 'https://torrentday.eu/download.php/%s/%s',
'test': 'https://classic.torrentday.com/',
'login': 'https://classic.torrentday.com/torrents/',
'login_check': 'https://classic.torrentday.com/userdetails.php',
'detail': 'https://classic.torrentday.com/details.php?id=%s',
'search': 'https://classic.torrentday.com/V3/API/API.php',
'download': 'https://classic.torrentday.com/download.php/%s/%s',
}
http_time_between_calls = 1 # Seconds
def loginDownload(self, url = '', nzb_id = ''):
try:
if not self.login():
log.error('Failed downloading from %s', self.getName())
return self.urlopen(url, headers=self.getRequestHeaders())
except:
log.error('Failed downloading from %s: %s', (self.getName(), traceback.format_exc()))
def _searchOnTitle(self, title, media, quality, results):
query = '"%s" %s' % (title, media['info']['year'])
@ -31,7 +39,7 @@ class Base(TorrentProvider):
'search': query,
}
data = self.getJsonData(self.urls['search'], data = data)
data = self.getJsonData(self.urls['search'], data = data, headers = self.getRequestHeaders())
try: torrents = data.get('Fs', [])[0].get('Cn', {}).get('torrents', [])
except: return
@ -46,6 +54,11 @@ class Base(TorrentProvider):
'leechers': tryInt(torrent.get('leech')),
})
def getRequestHeaders(self):
return {
'Cookie': self.conf('cookiesetting') or ''
}
def getLoginParams(self):
return {
'username': self.conf('username'),
@ -73,7 +86,7 @@ config = [{
'tab': 'searcher',
'list': 'torrent_providers',
'name': 'TorrentDay',
'description': '<a href="https://torrentday.eu/" target="_blank">TorrentDay</a>',
'description': '<a href="https://classic.torrentday.com/" target="_blank">TorrentDay</a>',
'wizard': True,
'ic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119,12 @@ config = [{
'description': 'Will not be (re)moved until this seed time (in hours) is met.',
},
{
'name': 'cookiesetting',
'label': 'Cookies',
'default': '',
'description': 'Cookies',
},
{
'name': 'extra_score',
'advanced': True,
'label': 'Extra Score',

Loading…
Cancel
Save