summaryrefslogtreecommitdiff
path: root/searx/engines/deviantart.py
diff options
context:
space:
mode:
authorCqoicebordel <Cqoicebordel@users.noreply.github.com>2015-01-29 01:13:33 +0100
committerCqoicebordel <Cqoicebordel@users.noreply.github.com>2015-01-29 01:13:33 +0100
commitd4957045513d6fb32dcffbc7ea87483479a8cb6e (patch)
tree6a47a0db0f0a39b202e2c31a2834a1eeaa815cb5 /searx/engines/deviantart.py
parent1d255061c7422045ef912a471500513832e0319f (diff)
downloadsearxng-d4957045513d6fb32dcffbc7ea87483479a8cb6e.tar.gz
searxng-d4957045513d6fb32dcffbc7ea87483479a8cb6e.zip
Deviant Art's unit test
Diffstat (limited to 'searx/engines/deviantart.py')
-rw-r--r--searx/engines/deviantart.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/searx/engines/deviantart.py b/searx/engines/deviantart.py
index 6284cf598..4198e8c76 100644
--- a/searx/engines/deviantart.py
+++ b/searx/engines/deviantart.py
@@ -14,6 +14,7 @@ from urllib import urlencode
from urlparse import urljoin
from lxml import html
import re
+from searx.engines.xpath import extract_text
# engine dependent config
categories = ['images']
@@ -50,9 +51,9 @@ def response(resp):
for result in dom.xpath('//div[contains(@class, "tt-a tt-fh")]'):
link = result.xpath('.//a[contains(@class, "thumb")]')[0]
url = urljoin(base_url, link.attrib.get('href'))
- title_links = result.xpath('.//span[@class="details"]//a[contains(@class, "t")]') # noqa
- title = ''.join(title_links[0].xpath('.//text()'))
- thumbnail_src = link.xpath('.//img')[0].attrib['src']
+ title_links = result.xpath('.//span[@class="details"]//a[contains(@class, "t")]')
+ title = extract_text(title_links[0])
+ thumbnail_src = link.xpath('.//img')[0].attrib.get('src')
img_src = regex.sub('/', thumbnail_src)
# append result