mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-23 14:45:22 -07:00
Search: Fix KickAssTorrents search plugin
(cherry picked from commit fa30d7bd1c
)
This commit is contained in:
parent
30b7927ee5
commit
083cab3118
2 changed files with 12 additions and 10 deletions
|
@ -1,4 +1,4 @@
|
||||||
#VERSION: 1.2
|
#VERSION: 1.21
|
||||||
#AUTHORS: Christophe Dumez (chris@qbittorrent.org)
|
#AUTHORS: Christophe Dumez (chris@qbittorrent.org)
|
||||||
|
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -31,9 +31,9 @@ from helpers import retrieve_url, download_file
|
||||||
import json
|
import json
|
||||||
|
|
||||||
class kickasstorrents(object):
|
class kickasstorrents(object):
|
||||||
url = 'http://www.kickasstorrents.com'
|
url = 'http://www.kat.ph'
|
||||||
name = 'kickasstorrents'
|
name = 'kickasstorrents'
|
||||||
supported_categories = {'all': 'all', 'movies': 'movies', 'tv': 'tv', 'music': 'music', 'games': 'games', 'software': 'applications'}
|
supported_categories = {'all': '', 'movies': 'Movies', 'tv': 'TV', 'music': 'Music', 'games': 'Games', 'software': 'Applications'}
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.results = []
|
self.results = []
|
||||||
|
@ -46,16 +46,17 @@ class kickasstorrents(object):
|
||||||
i = 1
|
i = 1
|
||||||
while True and i<11:
|
while True and i<11:
|
||||||
results = []
|
results = []
|
||||||
json_data = retrieve_url(self.url+'/search/%s/%d/?categories[]=%s&field=seeders&sorder=desc&json=1'%(what, i, self.supported_categories[cat]))
|
json_data = retrieve_url(self.url+'/json.php?q=%s&page=%d'%(what, i))
|
||||||
try:
|
try:
|
||||||
json_dict = json.loads(json_data)
|
json_dict = json.loads(json_data)
|
||||||
except:
|
except:
|
||||||
i += 1
|
i += 1
|
||||||
continue
|
continue
|
||||||
if json_dict['total_results'] <= 0: return
|
if int(json_dict['total_results']) <= 0: return
|
||||||
results = json_dict['list']
|
results = json_dict['list']
|
||||||
for r in results:
|
for r in results:
|
||||||
try:
|
try:
|
||||||
|
if cat != 'all' and self.supported_categories[cat] != r['category']: continue
|
||||||
res_dict = dict()
|
res_dict = dict()
|
||||||
res_dict['name'] = r['title']
|
res_dict['name'] = r['title']
|
||||||
res_dict['size'] = str(r['size'])
|
res_dict['size'] = str(r['size'])
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#VERSION: 1.2
|
#VERSION: 1.21
|
||||||
#AUTHORS: Christophe Dumez (chris@qbittorrent.org)
|
#AUTHORS: Christophe Dumez (chris@qbittorrent.org)
|
||||||
|
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -31,9 +31,9 @@ from helpers import retrieve_url, download_file
|
||||||
import json
|
import json
|
||||||
|
|
||||||
class kickasstorrents(object):
|
class kickasstorrents(object):
|
||||||
url = 'http://www.kickasstorrents.com'
|
url = 'http://www.kat.ph'
|
||||||
name = 'kickasstorrents'
|
name = 'kickasstorrents'
|
||||||
supported_categories = {'all': 'all', 'movies': 'movies', 'tv': 'tv', 'music': 'music', 'games': 'games', 'software': 'applications'}
|
supported_categories = {'all': '', 'movies': 'Movies', 'tv': 'TV', 'music': 'Music', 'games': 'Games', 'software': 'Applications'}
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.results = []
|
self.results = []
|
||||||
|
@ -46,16 +46,17 @@ class kickasstorrents(object):
|
||||||
i = 1
|
i = 1
|
||||||
while True and i<11:
|
while True and i<11:
|
||||||
results = []
|
results = []
|
||||||
json_data = retrieve_url(self.url+'/search/%s/%d/?categories[]=%s&field=seeders&sorder=desc&json=1'%(what, i, self.supported_categories[cat]))
|
json_data = retrieve_url(self.url+'/json.php?q=%s&page=%d'%(what, i))
|
||||||
try:
|
try:
|
||||||
json_dict = json.loads(json_data)
|
json_dict = json.loads(json_data)
|
||||||
except:
|
except:
|
||||||
i += 1
|
i += 1
|
||||||
continue
|
continue
|
||||||
if json_dict['total_results'] <= 0: return
|
if int(json_dict['total_results']) <= 0: return
|
||||||
results = json_dict['list']
|
results = json_dict['list']
|
||||||
for r in results:
|
for r in results:
|
||||||
try:
|
try:
|
||||||
|
if cat != 'all' and self.supported_categories[cat] != r['category']: continue
|
||||||
res_dict = dict()
|
res_dict = dict()
|
||||||
res_dict['name'] = r['title']
|
res_dict['name'] = r['title']
|
||||||
res_dict['size'] = str(r['size'])
|
res_dict['size'] = str(r['size'])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue