reworked Kickass
parent
5dd2c94fed
commit
f07f5e33a5
|
@ -21,8 +21,6 @@
|
||||||
import urllib
|
import urllib
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import urllib2
|
|
||||||
import xml.etree.ElementTree as ET
|
|
||||||
|
|
||||||
import SearcherABC
|
import SearcherABC
|
||||||
|
|
||||||
|
@ -65,32 +63,28 @@ class KickAssSo(SearcherABC.SearcherABC):
|
||||||
|
|
||||||
def search(self, keyword):
|
def search(self, keyword):
|
||||||
filesList = []
|
filesList = []
|
||||||
url = "http://kickass.so/usearch/%s/?rss=1" % urllib.quote_plus(keyword)
|
url = "http://kickass.so/usearch/%s/?field=seeders&sorder=desc" % urllib.quote_plus(keyword)
|
||||||
headers = {
|
headers = [('User-Agent',
|
||||||
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 YaBrowser/14.10.2062.12061 Safari/537.36',
|
'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 YaBrowser/14.10.2062.12061 Safari/537.36'),
|
||||||
'Referer': 'http://kickass.so/', }
|
('Referer', 'http://kickass.so/'), ('Accept-encoding', 'gzip'), ]
|
||||||
response = urllib2.Request(url, headers=headers)
|
response = self.makeRequest(url, headers=headers)
|
||||||
response = urllib2.urlopen(response)
|
|
||||||
|
|
||||||
if None != response:
|
|
||||||
response = response.read()
|
|
||||||
|
|
||||||
if None != response and 0 < len(response):
|
if None != response and 0 < len(response):
|
||||||
#print response
|
#print response
|
||||||
torrent = re.compile('xmlns:torrent="(.+?)"').findall(response)[0]
|
good_forums=['TV','Anime','Movies']
|
||||||
dat = ET.fromstring(response)
|
result = re.compile(
|
||||||
for item in dat.findall('channel')[0].findall('item'):
|
r'''<a title="Download torrent file" href="(.+?)\?.+?" class=".+?"><i.+?<a.+?<a.+?<a href=".+?html" class=".+?">(.+?)</a>.+? in <span.+?"><strong>.+?">(.+?)</a>.+?<td class="nobr center">(.+?)</td>.+?<td class="green center">(\d+?)</td>.+?<td class="red lasttd center">(\d+?)</td>''',
|
||||||
torrentTitle = item.find('title').text
|
re.DOTALL).findall(response)
|
||||||
size = self.sizeConvert(long(item.find('{%s}contentLength' % torrent).text))
|
for link,title,forum,size,seeds,leechers in result:
|
||||||
seeds = item.find('{%s}seeds' % torrent).text
|
if forum in good_forums:
|
||||||
leechers = item.find('{%s}peers' % torrent).text
|
torrentTitle = self.unescape(self.stripHtml(title))
|
||||||
link = item.find('enclosure').attrib['url']
|
size = self.unescape(self.stripHtml(size))
|
||||||
image = sys.modules["__main__"].__root__ + self.searchIcon
|
image = sys.modules["__main__"].__root__ + self.searchIcon
|
||||||
#print link
|
#print link
|
||||||
filesList.append((
|
filesList.append((
|
||||||
int(int(self.sourceWeight) * int(seeds)),
|
int(int(self.sourceWeight) * int(seeds)),
|
||||||
int(seeds), int(leechers), size,
|
int(seeds), int(leechers), size,
|
||||||
self.unescape(self.stripHtml(torrentTitle)),
|
torrentTitle,
|
||||||
self.__class__.__name__ + '::' + link,
|
self.__class__.__name__ + '::' + link,
|
||||||
image,
|
image,
|
||||||
))
|
))
|
||||||
|
|
Loading…
Reference in New Issue