Private GIT

Skip to content
Snippets Groups Projects
Commit d712bdd8 authored by supergonkas's avatar supergonkas Committed by miigotu
Browse files

Add LimeTorrents

parent c0272e9e
Branches
Tags
No related merge requests found
File suppressed by a .gitattributes entry, the file's encoding is unsupported, or the file size exceeds the limit.
...@@ -26,7 +26,7 @@ from sickbeard import logger ...@@ -26,7 +26,7 @@ from sickbeard import logger
from sickbeard.providers import btn, newznab, rsstorrent, womble, thepiratebay, torrentleech, kat, iptorrents, torrentz, \ from sickbeard.providers import btn, newznab, rsstorrent, womble, thepiratebay, torrentleech, kat, iptorrents, torrentz, \
omgwtfnzbs, scc, hdtorrents, torrentday, hdbits, hounddawgs, speedcd, nyaatorrents, animenzb, bluetigers, cpasbien, fnt, xthor, torrentbytes, \ omgwtfnzbs, scc, hdtorrents, torrentday, hdbits, hounddawgs, speedcd, nyaatorrents, animenzb, bluetigers, cpasbien, fnt, xthor, torrentbytes, \
freshontv, titansoftv, morethantv, bitsoup, t411, tokyotoshokan, shazbat, rarbg, alpharatio, tntvillage, binsearch, torrentproject, extratorrent, \ freshontv, titansoftv, morethantv, bitsoup, t411, tokyotoshokan, shazbat, rarbg, alpharatio, tntvillage, binsearch, torrentproject, extratorrent, \
scenetime, btdigg, transmitthenet, tvchaosuk, bitcannon, pretome, gftracker, hdspace, newpct, elitetorrent, bitsnoop, danishbits, hd4free scenetime, btdigg, transmitthenet, tvchaosuk, bitcannon, pretome, gftracker, hdspace, newpct, elitetorrent, bitsnoop, danishbits, hd4free, limetorrents
__all__ = [ __all__ = [
'womble', 'btn', 'thepiratebay', 'kat', 'torrentleech', 'scc', 'hdtorrents', 'womble', 'btn', 'thepiratebay', 'kat', 'torrentleech', 'scc', 'hdtorrents',
...@@ -36,7 +36,7 @@ __all__ = [ ...@@ -36,7 +36,7 @@ __all__ = [
'shazbat', 'rarbg', 'tntvillage', 'binsearch', 'bluetigers', 'cpasbien', 'shazbat', 'rarbg', 'tntvillage', 'binsearch', 'bluetigers', 'cpasbien',
'fnt', 'xthor', 'scenetime', 'btdigg', 'transmitthenet', 'tvchaosuk', 'fnt', 'xthor', 'scenetime', 'btdigg', 'transmitthenet', 'tvchaosuk',
'torrentproject', 'extratorrent', 'bitcannon', 'torrentz', 'pretome', 'gftracker', 'torrentproject', 'extratorrent', 'bitcannon', 'torrentz', 'pretome', 'gftracker',
'hdspace', 'newpct', 'elitetorrent', 'bitsnoop', 'danishbits', 'hd4free' 'hdspace', 'newpct', 'elitetorrent', 'bitsnoop', 'danishbits', 'hd4free', 'limetorrents'
] ]
......
# coding=utf-8
# Author: Gonçalo (aka duramato/supergonkas) <matigonkas@outlook.com>
# URL: https://github.com/SickRage/sickrage
# This file is part of SickRage.
#
# SickRage is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# SickRage is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with SickRage. If not, see <http://www.gnu.org/licenses/>.
import traceback
from bs4 import BeautifulSoup
import sickbeard
from sickbeard import logger
from sickbeard import tvcache
from sickbeard.common import USER_AGENT
from sickrage.helper.common import try_int
from sickrage.providers.torrent.TorrentProvider import TorrentProvider
class LimeTorrentsProvider(TorrentProvider): # pylint: disable=too-many-instance-attributes
def __init__(self):
TorrentProvider.__init__(self, "LimeTorrents")
self.urls = {
'index': 'https://www.limetorrents.cc/',
'search': 'https://www.limetorrents.cc/searchrss/20/',
'rss': 'https://www.limetorrents.cc/rss/20/'
}
self.url = self.urls['index']
self.public = True
self.ratio = None
self.minseed = None
self.minleech = None
self.headers.update({'User-Agent': USER_AGENT})
self.proper_strings = ['PROPER', 'REPACK']
self.cache = LimeTorrentsCache(self)
def search(self, search_strings, age=0, ep_obj=None): # pylint: disable=too-many-branches,too-many-locals
results = []
items = {'Season': [], 'Episode': [], 'RSS': []}
for mode in search_strings.keys():
logger.log(u"Search Mode: %s" % mode, logger.DEBUG)
for search_string in search_strings[mode]:
if mode != 'RSS':
logger.log(u"Search string: %s " % search_string, logger.DEBUG)
try:
url = (self.urls['rss'], self.urls['search'] + search_string)[mode != 'RSS']
logger.log(u"URL: %r " % url, logger.DEBUG)
data = self.get_url(url)
if not data:
logger.log(u"No data returned from provider", logger.DEBUG)
continue
if not data.startswith('<?xml'):
logger.log(u'Expected xml but got something else, is your mirror failing?', logger.INFO)
continue
data = BeautifulSoup(data, 'html5lib')
entries = entries = data.findAll('item')
for item in entries:
try:
title = item.title.text
download_url = item.enclosure['url']
if not (title and download_url):
continue
#seeders and leechers are presented diferently when doing a search and when looking for newly added
if mode == 'RSS':
# <![CDATA[
# Category: <a href="http://www.limetorrents.cc/browse-torrents/TV-shows/">TV shows</a><br /> Seeds: 1<br />Leechers: 0<br />Size: 7.71 GB<br /><br /><a href="http://www.limetorrents.cc/Owen-Hart-of-Gold-Djon91-torrent-7180661.html">More @ limetorrents.cc</a><br />
# ]]>
description = item.find('description')
smtg = (description.find_all('br')[0].next_sibling).strip()
smtg2 = (description.find_all('br')[1].next_sibling).strip()
seeders = smtg.lstrip('Seeds: ')
leechers = smtg2.lstrip('Leechers: ')
else:
#<description>Seeds: 6982 , Leechers 734</description>
description = item.find('description').text
seeders = description.split("Seeds: ")[-1].split()[0]
leechers = description.split("Leechers ")[-1].split()[0]
size = try_int(item.find('size').text, -1)
except (AttributeError, TypeError, KeyError, ValueError):
continue
# Filter unseeded torrent
if seeders < self.minseed or leechers < self.minleech:
if mode != 'RSS':
logger.log(u"Discarding torrent because it doesn't meet the minimum seeders or leechers: {0} (S:{1} L:{2})".format(title, seeders, leechers), logger.DEBUG)
continue
item = title, download_url, size, seeders, leechers
if mode != 'RSS':
logger.log(u"Found result: %s " % title, logger.DEBUG)
items[mode].append(item)
except (AttributeError, TypeError, KeyError, ValueError):
logger.log(u"Failed parsing provider. Traceback: %r" % traceback.format_exc(), logger.ERROR)
# For each search mode sort all the items by seeders if available
items[mode].sort(key=lambda tup: tup[3], reverse=True)
results += items[mode]
return results
def seed_ratio(self):
return self.ratio
class LimeTorrentsCache(tvcache.TVCache):
def __init__(self, provider_obj):
tvcache.TVCache.__init__(self, provider_obj)
self.minTime = 20
def _getRSSData(self):
search_strings = {'RSS': ['rss']}
return {'entries': self.provider.search(search_strings)}
provider = LimeTorrentsProvider()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment