summaryrefslogtreecommitdiff
path: root/searx/engines/deviantart.py
diff options
context:
space:
mode:
authorAdam Tauber <adam.tauber@balabit.com>2015-02-02 09:36:43 +0100
committerAdam Tauber <adam.tauber@balabit.com>2015-02-02 09:36:43 +0100
commit7f865356f9a6c1b40d0c668c59b3d081de618bac (patch)
tree60e9acb27577968a41136c04f248c24871e83860 /searx/engines/deviantart.py
parent03137eebd9fdfaa57452cb364c1bc9f31b243f67 (diff)
parent5a16077455ef9e821a2b5f5f7e975be8a37ce83d (diff)
Merge branch 'unit-tests' of https://github.com/Cqoicebordel/searx into Cqoicebordel-unit-tests
Conflicts: searx/tests/test_engines.py
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