3rd Party Providers

So you made CouchPotato even more awsome?
User avatar
clinton.hall
Moderator
Posts: 9224
Joined: 28 Jun 2012 12:55
Has thanked: 94 times
Been thanked: 465 times
Contact:
Status: Offline

3rd Party Providers

Postby clinton.hall » 01 Feb 2013 07:53

Hi All,

At this time RuudBurger is focusing CPS on supporting the widest possible community. As such, many of you might have noticed that foreign "providers" are not being added as they usually cater to just a small community.

Hence this thread. I want to start a collection of scripts added by the community:

Tehconnection.eu(General) - https://github.com/flightlevel/TehConne ... tatoPlugin
Deildu.net (Iceland) - https://github.com/trymbill/deildu-couch
Filelist.ro (Romania) - https://github.com/outkastm/Filelist.ro
Quorks.net (Germany) - https://github.com/clinton-hall/couchpo ... der.quorks (Site ShutDown)
Norbits (Norwegian) - https://github.com/terbolous/couchpotat ... er.norbits
NextGen (Danish) - https://github.com/beltoft/cps.nxtgn
DownRev (Israeli) - https://github.com/kobi-kadosh/CouchPot ... om-Plugins
T411 - https://github.com/djoole/couchpotato.provider.t411
PTN - https://github.com/Codehhh/PirateTheNet ... tatoPlugin
NNM_Club (Russian) - https://github.com/TheQwertiest/couchpo ... r.nnm_club

daba
Junior Member
Posts: 2
Joined: 19 Jan 2014 13:08
Status: Offline

Re: 3rd Party Providers

Postby daba » 20 Jan 2014 07:29

I have a working provider for nyaa torrents. Feel free to try it.

BTW, torrents on nyaa generally use the original japanese name (in romaji).
For example, for "Princess Mononoke", searching the english title, or the japanese one (Mononoke Hime) gives different results, and the best torrents are found with the japanese title.
It would be nice to be able to select the title used for searching for movies having titles in different languages.

__init__.py :

Code: Select all

from main import Nyaa

def start():
    return Nyaa()

config = [{
    'name': 'Nyaa',
    'groups': [
        {
            'tab': 'searcher',
            'list': 'torrent_providers',
            'name': 'Nyaa',
            'description': 'Anime movies provider. See <a href="http://nyaa.se/">Nyaa</a>',
            'wizard': True,
            'options': [
                {
                    'name': 'enabled',
                    'type': 'enabler',
                    'default': False
                },
                {
                    'name': 'extra_score',
                    'advanced': True,
                    'label': 'Extra Score',
                    'type': 'int',
                    'default': 100,
                    'description': 'Starting score for each release found via this provider.',
                }
            ],
        }
    ]
}]


main.py :

Code: Select all

from bs4 import BeautifulSoup
from couchpotato.core.helpers.encoding import toUnicode, tryUrlencode
from couchpotato.core.helpers.variable import tryInt, cleanHost
from couchpotato.core.logger import CPLog
from couchpotato.core.providers.torrent.base import TorrentProvider
from couchpotato.environment import Env
import time
import traceback

log = CPLog(__name__)


class Nyaa(TorrentProvider):

    urls = {
         'search': 'http://www.nyaa.se/?page=search&cats=1_37&filter=0&term=%s&sort=5'
    }

    http_time_between_calls = 1

    def _searchOnTitle(self, title, movie, quality, results):

        search_url = self.urls['search'] % (tryUrlencode(title))

        data = self.getHTMLData(search_url)

        if data:
            try:
                soup = BeautifulSoup(data)
                results_table = soup.find('table', attrs = {'class': 'tlist'})

                if not results_table:
                    return

                entries = results_table.find_all('tr')
                for result in entries[1:]:
                    cells = result.find_all('td')
                    link = cells[2].find('a')['href']
                    torrent_id = link.rsplit('=', 1)[1]

                    if link:

                        def extra_score(item):
                            if result['class'][0] == 'trusted':
                                return 150
                            if result['class'][0] == 'aplus':
                                return 200
                            return 0

                        log.debug('Nyaa torrent append : %s', cells[1].contents[0].get_text())
                        results.append({
                            'id': torrent_id,
                            'name': '%s (%s) - %s' % (title, movie['library']['year'], cells[1].contents[0].get_text()),
                            'url': link,
                            'detail_url': cells[1].find('a')['href'],
                            'size': self.parseSize(cells[3].get_text()),
                            'seeders': tryInt(cells[4].string),
                            'leechers': tryInt(cells[5].string),
                            'extra_score': extra_score,
                            'get_more_info': self.getMoreInfo
                        })

            except:
                log.error('Failed getting results from %s: %s', (self.getName(), traceback.format_exc()))

    def getMoreInfo(self, item):
        full_description = self.getCache('nyaa.%s' % item['id'], item['detail_url'], cache_timeout = 25920000)
        html = BeautifulSoup(full_description)
        nfo_pre = html.find('div', attrs = {'class':'viewdescription'})
        description = toUnicode(nfo_pre.text) if nfo_pre else ''

        item['description'] = description
        return item

jkaberg
Site Admin
Posts: 150
Joined: 10 May 2012 12:04
Has thanked: 3 times
Been thanked: 3 times
Status: Offline

Re: 3rd Party Providers

Postby jkaberg » 08 Mar 2014 10:30

Thread locked, please PM me or @clinton.hall to have your provider added.


Return to “External Tools”