summaryrefslogtreecommitdiff
path: root/searx/engines/www500px.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/www500px.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/www500px.py')
-rw-r--r--searx/engines/www500px.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/searx/engines/www500px.py b/searx/engines/www500px.py
index f25678c24..99dba4abf 100644
--- a/searx/engines/www500px.py
+++ b/searx/engines/www500px.py
@@ -15,6 +15,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']
@@ -22,7 +23,7 @@ paging = True
# search-url
base_url = 'https://500px.com'
-search_url = base_url+'/search?search?page={pageno}&type=photos&{query}'
+search_url = base_url + '/search?search?page={pageno}&type=photos&{query}'
# do search-request
@@ -44,11 +45,11 @@ def response(resp):
for result in dom.xpath('//div[@class="photo"]'):
link = result.xpath('.//a')[0]
url = urljoin(base_url, link.attrib.get('href'))
- title = result.xpath('.//div[@class="title"]//text()')[0]
- thumbnail_src = link.xpath('.//img')[0].attrib['src']
+ title = extract_text(result.xpath('.//div[@class="title"]'))
+ thumbnail_src = link.xpath('.//img')[0].attrib.get('src')
# To have a bigger thumbnail, uncomment the next line
- #thumbnail_src = regex.sub('4.jpg', thumbnail_src)
- content = result.xpath('.//div[@class="info"]//text()')[0]
+ # thumbnail_src = regex.sub('4.jpg', thumbnail_src)
+ content = extract_text(result.xpath('.//div[@class="info"]'))
img_src = regex.sub('2048.jpg', thumbnail_src)
# append result