6 changed files with 479 additions and 0 deletions
@ -0,0 +1,31 @@ |
|||
from .main import SceneAccess |
|||
|
|||
def start(): |
|||
return SceneAccess() |
|||
|
|||
config = [{ |
|||
'name': 'sceneaccess', |
|||
'groups': [ |
|||
{ |
|||
'tab': 'searcher', |
|||
'subtab': 'providers', |
|||
'name': 'SceneAccess', |
|||
'options': [ |
|||
{ |
|||
'name': 'enabled', |
|||
'type': 'enabler', |
|||
'default': False, |
|||
}, |
|||
{ |
|||
'name': 'username', |
|||
'default': '', |
|||
}, |
|||
{ |
|||
'name': 'password', |
|||
'default': '', |
|||
'type': 'password', |
|||
}, |
|||
], |
|||
}, |
|||
], |
|||
}] |
@ -0,0 +1,134 @@ |
|||
from bs4 import BeautifulSoup |
|||
from couchpotato.core.event import fireEvent |
|||
from couchpotato.core.helpers.variable import tryInt, getTitle |
|||
from couchpotato.core.logger import CPLog |
|||
from couchpotato.core.providers.torrent.base import TorrentProvider |
|||
import StringIO |
|||
import gzip |
|||
import re |
|||
import traceback |
|||
import urllib |
|||
import urllib2 |
|||
import cookielib |
|||
from urllib import quote_plus |
|||
from urllib2 import URLError |
|||
|
|||
log = CPLog(__name__) |
|||
|
|||
|
|||
class SceneAccess(TorrentProvider): |
|||
|
|||
urls = { |
|||
'test': 'https://www.sceneaccess.eu/', |
|||
'detail': 'https://www.sceneaccess.eu/details?id=%s', |
|||
'search': 'https://www.sceneaccess.eu/browse?search=%s&method=2&c%d=%d', |
|||
'download': 'https://www.sceneaccess.eu/%s', |
|||
} |
|||
|
|||
cat_ids = [ |
|||
([22], ['720p', '1080p']), |
|||
([7], ['cam', 'ts', 'dvdrip', 'tc', 'r5', 'scr', 'brrip']), |
|||
([8], ['dvdr']), |
|||
] |
|||
|
|||
http_time_between_calls = 1 #seconds |
|||
|
|||
def search(self, movie, quality): |
|||
|
|||
results = [] |
|||
if self.isDisabled(): |
|||
return results |
|||
|
|||
cache_key = 'sceneaccess.%s.%s' % (movie['library']['identifier'], quality.get('identifier')) |
|||
searchUrl = self.urls['search'] % (quote_plus(getTitle(movie['library']) + ' ' + quality['identifier']), self.getCatId(quality['identifier'])[0], self.getCatId(quality['identifier'])[0]) |
|||
data = self.getCache(cache_key, searchUrl) |
|||
|
|||
if data: |
|||
|
|||
cat_ids = self.getCatId(quality['identifier']) |
|||
|
|||
try: |
|||
cookiejar = cookielib.CookieJar() |
|||
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookiejar)) |
|||
urllib2.install_opener(opener) |
|||
params = urllib.urlencode(dict(username=''+self.conf('username'), password=''+self.conf('password'), submit='come on in')) |
|||
f = opener.open('https://www.sceneaccess.eu/login', params) |
|||
data = f.read() |
|||
f.close() |
|||
f = opener.open(searchUrl) |
|||
data = f.read() |
|||
f.close() |
|||
|
|||
except (IOError, URLError): |
|||
log.error('Failed to open %s.' % url) |
|||
return results |
|||
|
|||
html = BeautifulSoup(data) |
|||
|
|||
try: |
|||
resultsTable = html.find('table', attrs = {'id' : 'torrents-table'}) |
|||
entries = resultsTable.findAll('tr', attrs = {'class' : 'tt_row'}) |
|||
for result in entries: |
|||
new = { |
|||
'type': 'torrent', |
|||
'check_nzb': False, |
|||
'description': '', |
|||
'provider': self.getName(), |
|||
} |
|||
|
|||
link = result.find('td', attrs = {'class' : 'ttr_name'}).find('a') |
|||
new['name'] = link['title'] |
|||
new['id'] = link['href'].replace('details?id=', '') |
|||
url = result.find('td', attrs = {'class' : 'td_dl'}).find('a') |
|||
new['url'] = self.urls['download'] % url['href'] |
|||
new['size'] = self.parseSize(result.find('td', attrs = {'class' : 'ttr_size'}).contents[0]) |
|||
new['seeders'] = int(result.find('td', attrs = {'class' : 'ttr_seeders'}).find('a').string) |
|||
leechers = result.find('td', attrs = {'class' : 'ttr_leechers'}).find('a') |
|||
if leechers: |
|||
new['leechers'] = int(leechers.string) |
|||
else: |
|||
new['leechers'] = 0 |
|||
|
|||
new['imdbid'] = movie['library']['identifier'] |
|||
new['extra_score'] = self.extra_score |
|||
new['score'] = fireEvent('score.calculate', new, movie, single = True) |
|||
is_correct_movie = fireEvent('searcher.correct_movie', nzb = new, movie = movie, quality = quality, |
|||
imdb_results = True, single_category = False, single = True) |
|||
|
|||
if is_correct_movie: |
|||
new['download'] = self.download |
|||
results.append(new) |
|||
self.found(new) |
|||
return results |
|||
|
|||
except: |
|||
log.info("No results found at SceneAccess") |
|||
return [] |
|||
|
|||
def extra_score(self, nzb): |
|||
url = self.urls['detail'] % nzb['id'] |
|||
imdbId = nzb['imdbid'] |
|||
return self.imdbMatch(url, imdbId) |
|||
|
|||
def imdbMatch(self, url, imdbId): |
|||
try: |
|||
data = urllib2.urlopen(url).read() |
|||
pass |
|||
except IOError: |
|||
log.error('Failed to open %s.' % url) |
|||
return '' |
|||
|
|||
html = BeautifulSoup(data) |
|||
imdbDiv = html.find('span', attrs = {'class':'i_link'}) |
|||
imdbDiv = str(imdbDiv).decode("utf-8", "replace") |
|||
imdbIdAlt = re.sub('tt[0]*', 'tt', imdbId) |
|||
|
|||
if 'imdb.com/title/' + imdbId in imdbDiv or 'imdb.com/title/' + imdbIdAlt in imdbDiv: |
|||
return 50 |
|||
return 0 |
|||
|
|||
def download(self, url = '', nzb_id = ''): |
|||
torrent = self.urlopen(url) |
|||
return torrent |
|||
|
|||
|
@ -0,0 +1,31 @@ |
|||
from .main import SceneHD |
|||
|
|||
def start(): |
|||
return SceneHD() |
|||
|
|||
config = [{ |
|||
'name': 'scenehd', |
|||
'groups': [ |
|||
{ |
|||
'tab': 'searcher', |
|||
'subtab': 'providers', |
|||
'name': 'SceneHD', |
|||
'options': [ |
|||
{ |
|||
'name': 'enabled', |
|||
'type': 'enabler', |
|||
'default': False, |
|||
}, |
|||
{ |
|||
'name': 'username', |
|||
'default': '', |
|||
}, |
|||
{ |
|||
'name': 'password', |
|||
'default': '', |
|||
'type': 'password', |
|||
}, |
|||
], |
|||
}, |
|||
], |
|||
}] |
@ -0,0 +1,119 @@ |
|||
from bs4 import BeautifulSoup |
|||
from couchpotato.core.event import fireEvent |
|||
from couchpotato.core.helpers.variable import tryInt, getTitle |
|||
from couchpotato.core.logger import CPLog |
|||
from couchpotato.core.providers.torrent.base import TorrentProvider |
|||
import StringIO |
|||
import gzip |
|||
import re |
|||
import traceback |
|||
import urllib |
|||
import urllib2 |
|||
import cookielib |
|||
from urllib import quote_plus |
|||
from urllib2 import URLError |
|||
|
|||
|
|||
log = CPLog(__name__) |
|||
|
|||
|
|||
class SceneHD(TorrentProvider): |
|||
|
|||
urls = { |
|||
'test': 'http://scenehd.org/', |
|||
'detail': 'http://scenehd.org/details.php?id=%s', |
|||
'search': 'http://scenehd.org/browse.php?ajax&search=%s', |
|||
'download': 'http://scenehd.org/download.php?id=%s', |
|||
} |
|||
|
|||
http_time_between_calls = 1 #seconds |
|||
|
|||
def search(self, movie, quality): |
|||
|
|||
results = [] |
|||
if self.isDisabled(): |
|||
return results |
|||
|
|||
cache_key = 'scenehd.%s.%s' % (movie['library']['identifier'], quality.get('identifier')) |
|||
searchUrl = self.urls['search'] % (quote_plus(getTitle(movie['library']) + ' ' + quality['identifier'])) |
|||
data = self.getCache(cache_key, searchUrl) |
|||
|
|||
if data: |
|||
|
|||
try: |
|||
cookiejar = cookielib.CookieJar() |
|||
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookiejar)) |
|||
urllib2.install_opener(opener) |
|||
params = urllib.urlencode(dict(username=''+self.conf('username'), password=''+self.conf('password'), ssl='yes')) |
|||
f = opener.open('http://scenehd.org/takelogin.php', params) |
|||
data = f.read() |
|||
f.close() |
|||
f = opener.open(searchUrl) |
|||
data = f.read() |
|||
f.close() |
|||
|
|||
except (IOError, URLError): |
|||
log.error('Failed to open %s.' % url) |
|||
return results |
|||
|
|||
html = BeautifulSoup(data) |
|||
|
|||
try: |
|||
resultsTable = html.findAll('table')[6] |
|||
entries = resultsTable.findAll('tr') |
|||
for result in entries[1:]: |
|||
new = { |
|||
'type': 'torrent', |
|||
'check_nzb': False, |
|||
'description': '', |
|||
'provider': self.getName(), |
|||
} |
|||
|
|||
allCells = result.findAll('td') |
|||
new['size'] = self.parseSize(allCells[7].string.replace('GiB', 'GB')) |
|||
new['seeders'] = allCells[10].find('a').string |
|||
leechers = allCells[11].find('a') |
|||
if leechers: |
|||
new['leechers'] = leechers.string |
|||
else: |
|||
new['leechers'] = allCells[11].string |
|||
|
|||
detailLink = allCells[2].find('a') |
|||
details = detailLink['href'] |
|||
new['id'] = details.replace('details.php?id=', '') |
|||
new['name'] = detailLink['title'] |
|||
|
|||
imdbLink = allCells[1].find('a') |
|||
if imdbLink: |
|||
new['imdbresult'] = imdbLink['href'].replace('http://www.imdb.com/title/','').rstrip('/') |
|||
else: |
|||
new['imdbresult'] = 'tt00000000' |
|||
|
|||
new['url'] = self.urls['download'] % new['id'] |
|||
new['imdbid'] = movie['library']['identifier'] |
|||
new['extra_score'] = self.extra_score |
|||
new['score'] = fireEvent('score.calculate', new, movie, single = True) |
|||
is_correct_movie = fireEvent('searcher.correct_movie', nzb = new, movie = movie, quality = quality, |
|||
imdb_results = True, single_category = False, single = True) |
|||
|
|||
if is_correct_movie: |
|||
new['download'] = self.download |
|||
results.append(new) |
|||
self.found(new) |
|||
return results |
|||
|
|||
except: |
|||
log.info("No results found at SceneHD") |
|||
return [] |
|||
|
|||
def extra_score(self, nzb): |
|||
imdbIdAlt = re.sub('tt[0]*', 'tt', nzb['imdbresult']) |
|||
if nzb['imdbresult'] == nzb['imdbid'] or imdbIdAlt == nzb['imdbid']: |
|||
return 50 |
|||
return 0 |
|||
|
|||
def download(self, url = '', nzb_id = ''): |
|||
torrent = self.urlopen(url) |
|||
return torrent |
|||
|
|||
|
@ -0,0 +1,31 @@ |
|||
from .main import TorrentLeech |
|||
|
|||
def start(): |
|||
return TorrentLeech() |
|||
|
|||
config = [{ |
|||
'name': 'torrentleech', |
|||
'groups': [ |
|||
{ |
|||
'tab': 'searcher', |
|||
'subtab': 'providers', |
|||
'name': 'TorrentLeech', |
|||
'options': [ |
|||
{ |
|||
'name': 'enabled', |
|||
'type': 'enabler', |
|||
'default': False, |
|||
}, |
|||
{ |
|||
'name': 'username', |
|||
'default': '', |
|||
}, |
|||
{ |
|||
'name': 'password', |
|||
'default': '', |
|||
'type': 'password', |
|||
}, |
|||
], |
|||
}, |
|||
], |
|||
}] |
@ -0,0 +1,133 @@ |
|||
from bs4 import BeautifulSoup |
|||
from couchpotato.core.event import fireEvent |
|||
from couchpotato.core.helpers.variable import tryInt, getTitle |
|||
from couchpotato.core.logger import CPLog |
|||
from couchpotato.core.providers.torrent.base import TorrentProvider |
|||
import StringIO |
|||
import gzip |
|||
import re |
|||
import traceback |
|||
import urllib |
|||
import urllib2 |
|||
import cookielib |
|||
from urllib import quote_plus |
|||
from urllib2 import URLError |
|||
import sys |
|||
|
|||
|
|||
log = CPLog(__name__) |
|||
|
|||
|
|||
class TorrentLeech(TorrentProvider): |
|||
|
|||
urls = { |
|||
'test' : 'http://torrentleech.org/', |
|||
'detail' : 'http://torrentleech.org/torrent/%s', |
|||
'search' : 'http://torrentleech.org/torrents/browse/index/query/%s/categories/%d', |
|||
'download' : 'http://torrentleech.org%s', |
|||
} |
|||
|
|||
cat_ids = [ |
|||
([13], ['720p', '1080p']), |
|||
([8], ['cam']), |
|||
([9], ['ts', 'tc']), |
|||
([10], ['r5', 'scr']), |
|||
([11], ['dvdrip']), |
|||
([14], ['brrip']), |
|||
([12], ['dvdr']), |
|||
] |
|||
|
|||
http_time_between_calls = 1 #seconds |
|||
|
|||
def search(self, movie, quality): |
|||
|
|||
results = [] |
|||
if self.isDisabled(): |
|||
return results |
|||
|
|||
cache_key = 'torrentleech.%s.%s' % (movie['library']['identifier'], quality.get('identifier')) |
|||
searchUrl = self.urls['search'] % (quote_plus(getTitle(movie['library']) + ' ' + quality['identifier']), self.getCatId(quality['identifier'])[0]) |
|||
data = self.getCache(cache_key, searchUrl) |
|||
|
|||
if data: |
|||
|
|||
cat_ids = self.getCatId(quality['identifier']) |
|||
|
|||
try: |
|||
cookiejar = cookielib.CookieJar() |
|||
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookiejar)) |
|||
urllib2.install_opener(opener) |
|||
params = urllib.urlencode(dict(username=''+self.conf('username'), password=''+self.conf('password'), remember_me='on', login='submit')) |
|||
f = opener.open('http://torrentleech.org/user/account/login/', params) |
|||
data = f.read() |
|||
f.close() |
|||
f = opener.open(searchUrl) |
|||
data = f.read() |
|||
f.close() |
|||
|
|||
except (IOError, URLError): |
|||
log.error('Failed to open %s.' % url) |
|||
return results |
|||
|
|||
html = BeautifulSoup(data) |
|||
|
|||
try: |
|||
resultsTable = html.find('table', attrs = {'id' : 'torrenttable'}) |
|||
entries = resultsTable.findAll('tr') |
|||
for result in entries[1:]: |
|||
new = { |
|||
'type': 'torrent', |
|||
'check_nzb': False, |
|||
'description': '', |
|||
'provider': self.getName(), |
|||
} |
|||
|
|||
link = result.find('td', attrs = {'class' : 'name'}).find('a') |
|||
new['name'] = link.string |
|||
new['id'] = link['href'].replace('/torrent/', '') |
|||
url = result.find('td', attrs = {'class' : 'quickdownload'}).find('a') |
|||
new['url'] = self.urls['download'] % url['href'] |
|||
new['size'] = self.parseSize(result.findAll('td')[4].string) |
|||
new['seeders'] = int(result.find('td', attrs = {'class' : 'seeders'}).string) |
|||
new['leechers'] = int(result.find('td', attrs = {'class' : 'leechers'}).string) |
|||
new['imdbid'] = movie['library']['identifier'] |
|||
|
|||
new['extra_score'] = self.extra_score |
|||
new['score'] = fireEvent('score.calculate', new, movie, single = True) |
|||
is_correct_movie = fireEvent('searcher.correct_movie', nzb = new, movie = movie, quality = quality, |
|||
imdb_results = True, single_category = False, single = True) |
|||
|
|||
if is_correct_movie: |
|||
new['download'] = self.download |
|||
results.append(new) |
|||
self.found(new) |
|||
return results |
|||
|
|||
except: |
|||
log.info("No results found at TorrentLeech") |
|||
return [] |
|||
|
|||
def extra_score(self, nzb): |
|||
url = self.urls['detail'] % nzb['id'] |
|||
imdbId = nzb['imdbid'] |
|||
return self.imdbMatch(url, imdbId) |
|||
|
|||
def imdbMatch(self, url, imdbId): |
|||
try: |
|||
data = urllib2.urlopen(url).read() |
|||
pass |
|||
except IOError: |
|||
log.error('Failed to open %s.' % url) |
|||
return '' |
|||
|
|||
imdbIdAlt = re.sub('tt[0]*', 'tt', imdbId) |
|||
data = unicode(data, errors='ignore') |
|||
if 'imdb.com/title/' + imdbId in data or 'imdb.com/title/' + imdbIdAlt in data: |
|||
return 50 |
|||
return 0 |
|||
|
|||
def download(self, url = '', nzb_id = ''): |
|||
torrent = self.urlopen(url) |
|||
return torrent |
|||
|
|||
|
Loading…
Reference in new issue