diff options
| author | Cqoicebordel <Cqoicebordel@users.noreply.github.com> | 2015-01-30 21:02:17 +0100 |
|---|---|---|
| committer | Cqoicebordel <Cqoicebordel@users.noreply.github.com> | 2015-01-30 21:02:17 +0100 |
| commit | 8ea749d6ec0b711c516f3dbdb34a1bd17ae7d945 (patch) | |
| tree | d86589c90ac0091b52adb4158c29ac4e0f974629 /searx/engines/kickass.py | |
| parent | 52a57ee045e02844a8f650a9d3ae30e0092d86cd (diff) | |
Kickass' unit test
Diffstat (limited to 'searx/engines/kickass.py')
| -rw-r--r-- | searx/engines/kickass.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/searx/engines/kickass.py b/searx/engines/kickass.py index ac349283d..8b89e1f47 100644 --- a/searx/engines/kickass.py +++ b/searx/engines/kickass.py @@ -13,6 +13,7 @@ from cgi import escape from urllib import quote from lxml import html from operator import itemgetter +from searx.engines.xpath import extract_text # engine dependent config categories = ['videos', 'music', 'files'] @@ -56,9 +57,8 @@ def response(resp): for result in search_res[1:]: link = result.xpath('.//a[@class="cellMainLink"]')[0] href = urljoin(url, link.attrib['href']) - title = ' '.join(link.xpath('.//text()')) - content = escape(html.tostring(result.xpath(content_xpath)[0], - method="text")) + title = extract_text(link) + content = escape(extract_text(result.xpath(content_xpath))) seed = result.xpath('.//td[contains(@class, "green")]/text()')[0] leech = result.xpath('.//td[contains(@class, "red")]/text()')[0] filesize = result.xpath('.//td[contains(@class, "nobr")]/text()')[0] @@ -88,7 +88,7 @@ def response(resp): filesize = int(filesize * 1024 * 1024 * 1024) elif filesize_multiplier == 'MB': filesize = int(filesize * 1024 * 1024) - elif filesize_multiplier == 'kb': + elif filesize_multiplier == 'KB': filesize = int(filesize * 1024) except: filesize = None |