From fa30d7bd1c8f0e32c13af96f19afe135a6e0636c Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Sun, 11 Sep 2011 21:24:00 +0300 Subject: [PATCH] Search: Fix KickAssTorrents search plugin --- src/searchengine/nova/engines/kickasstorrents.py | 11 ++++++----- src/searchengine/nova3/engines/kickasstorrents.py | 11 ++++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/searchengine/nova/engines/kickasstorrents.py b/src/searchengine/nova/engines/kickasstorrents.py index 634113cb4..9ceafaf59 100755 --- a/src/searchengine/nova/engines/kickasstorrents.py +++ b/src/searchengine/nova/engines/kickasstorrents.py @@ -1,4 +1,4 @@ -#VERSION: 1.2 +#VERSION: 1.21 #AUTHORS: Christophe Dumez (chris@qbittorrent.org) # Redistribution and use in source and binary forms, with or without @@ -31,9 +31,9 @@ from helpers import retrieve_url, download_file import json class kickasstorrents(object): - url = 'http://www.kickasstorrents.com' + url = 'http://www.kat.ph' 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): self.results = [] @@ -46,16 +46,17 @@ class kickasstorrents(object): i = 1 while True and i<11: 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: json_dict = json.loads(json_data) except: i += 1 continue - if json_dict['total_results'] <= 0: return + if int(json_dict['total_results']) <= 0: return results = json_dict['list'] for r in results: try: + if cat != 'all' and self.supported_categories[cat] != r['category']: continue res_dict = dict() res_dict['name'] = r['title'] res_dict['size'] = str(r['size']) diff --git a/src/searchengine/nova3/engines/kickasstorrents.py b/src/searchengine/nova3/engines/kickasstorrents.py index 7593da58f..63e81d32d 100755 --- a/src/searchengine/nova3/engines/kickasstorrents.py +++ b/src/searchengine/nova3/engines/kickasstorrents.py @@ -1,4 +1,4 @@ -#VERSION: 1.2 +#VERSION: 1.21 #AUTHORS: Christophe Dumez (chris@qbittorrent.org) # Redistribution and use in source and binary forms, with or without @@ -31,9 +31,9 @@ from helpers import retrieve_url, download_file import json class kickasstorrents(object): - url = 'http://www.kickasstorrents.com' + url = 'http://www.kat.ph' 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): self.results = [] @@ -46,16 +46,17 @@ class kickasstorrents(object): i = 1 while True and i<11: 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: json_dict = json.loads(json_data) except: i += 1 continue - if json_dict['total_results'] <= 0: return + if int(json_dict['total_results']) <= 0: return results = json_dict['list'] for r in results: try: + if cat != 'all' and self.supported_categories[cat] != r['category']: continue res_dict = dict() res_dict['name'] = r['title'] res_dict['size'] = str(r['size'])