Yifi cleanup
This commit is contained in:
1 parent
9bcd3de69b
commit
bd56539103
2 files changed
+24
-16
No files matched your search
@@ -11,7 +11,7 @@ config = [{
|
|||||||
'subtab': 'providers',
|
'subtab': 'providers',
|
||||||
'list': 'torrent_providers',
|
'list': 'torrent_providers',
|
||||||
'name': 'Yify',
|
'name': 'Yify',
|
||||||
'description': 'Small HD movies, encoded by Yify.',
|
'description': 'Free provider, less accurate. Small HD movies, encoded by <a href="https://yify-torrents.com/">Yify</a>.',
|
||||||
'wizard': False,
|
'wizard': False,
|
||||||
'options': [
|
'options': [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,18 +1,14 @@
|
|||||||
from couchpotato.core.helpers.encoding import toUnicode, tryUrlencode
|
from couchpotato.core.helpers.encoding import toUnicode, tryUrlencode
|
||||||
from couchpotato.core.helpers.variable import tryInt, cleanHost
|
from couchpotato.core.helpers.variable import tryInt
|
||||||
from couchpotato.core.logger import CPLog
|
from couchpotato.core.logger import CPLog
|
||||||
from couchpotato.core.providers.torrent.base import TorrentProvider
|
from couchpotato.core.providers.torrent.base import TorrentProvider
|
||||||
from couchpotato.environment import Env
|
|
||||||
import re
|
|
||||||
import time
|
|
||||||
import traceback
|
import traceback
|
||||||
from pprint import pprint
|
|
||||||
|
|
||||||
log = CPLog(__name__)
|
log = CPLog(__name__)
|
||||||
|
|
||||||
|
|
||||||
class Yify(TorrentProvider):
|
class Yify(TorrentProvider):
|
||||||
|
|
||||||
urls = {
|
urls = {
|
||||||
'test' : 'https://yify-torrents.com/api',
|
'test' : 'https://yify-torrents.com/api',
|
||||||
'search' : 'https://yify-torrents.com/api/list.json?keywords=%s&quality=%s',
|
'search' : 'https://yify-torrents.com/api/list.json?keywords=%s&quality=%s',
|
||||||
@@ -21,19 +17,31 @@ class Yify(TorrentProvider):
|
|||||||
|
|
||||||
http_time_between_calls = 1 #seconds
|
http_time_between_calls = 1 #seconds
|
||||||
|
|
||||||
def _search(self, movie, quality, results):
|
def search(self, movie, quality):
|
||||||
try:
|
|
||||||
data = self.getJsonData(self.urls['search'] % (movie['library']['title'], quality['identifier']))
|
if not quality.get('hd', False):
|
||||||
except:
|
return []
|
||||||
log.error('Search on Yify (%s) failed (could not decode JSON)', params)
|
|
||||||
return
|
return super(Yify, self).search(movie, quality)
|
||||||
|
|
||||||
|
def _searchOnTitle(self, title, movie, quality, results):
|
||||||
|
|
||||||
|
data = self.getJsonData(self.urls['search'] % (title, quality['identifier']))
|
||||||
|
|
||||||
if data:
|
if data:
|
||||||
try:
|
try:
|
||||||
for result in data:
|
for result in data.get('MovieList'):
|
||||||
|
|
||||||
|
try:
|
||||||
|
title = result['TorrentUrl'].split('/')[-1][:-8].replace('_', '.').strip('._')
|
||||||
|
title = title.replace('.-.', '-')
|
||||||
|
title = title.replace('..', '.')
|
||||||
|
except:
|
||||||
|
continue
|
||||||
|
|
||||||
results.append({
|
results.append({
|
||||||
'id': result['MovieID'],
|
'id': result['MovieID'],
|
||||||
'name': result['MovieTitle'],
|
'name': title,
|
||||||
'url': result['TorrentUrl'],
|
'url': result['TorrentUrl'],
|
||||||
'detail_url': self.urls['detail'] % result['MovieID'],
|
'detail_url': self.urls['detail'] % result['MovieID'],
|
||||||
'size': self.parseSize(result['Size']),
|
'size': self.parseSize(result['Size']),
|
||||||
@@ -43,4 +51,4 @@ class Yify(TorrentProvider):
|
|||||||
|
|
||||||
except:
|
except:
|
||||||
log.error('Failed getting results from %s: %s', (self.getName(), traceback.format_exc()))
|
log.error('Failed getting results from %s: %s', (self.getName(), traceback.format_exc()))
|
||||||
|
|
||||||
Reference in new issue
Block a user