summaryrefslogtreecommitdiff
path: root/searx/engines/stackoverflow.py
diff options
context:
space:
mode:
authorasciimoo <asciimoo@gmail.com>2014-01-20 02:31:20 +0100
committerasciimoo <asciimoo@gmail.com>2014-01-20 02:31:20 +0100
commitb2492c94f422e18cb8954ec983134f4fa5c7cdc0 (patch)
tree969ea30e5dc642d896fa7b744571110ebfe13e7a /searx/engines/stackoverflow.py
parent692c0bf5f0b353bfbb46aaee1af54afb164dedbc (diff)
[fix] pep/flake8 compatibility
Diffstat (limited to 'searx/engines/stackoverflow.py')
-rw-r--r--searx/engines/stackoverflow.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/searx/engines/stackoverflow.py b/searx/engines/stackoverflow.py
index 9ee89bc6e..35230600f 100644
--- a/searx/engines/stackoverflow.py
+++ b/searx/engines/stackoverflow.py
@@ -7,6 +7,8 @@ categories = ['it']
url = 'http://stackoverflow.com/'
search_url = url+'search?'
+result_xpath = './/div[@class="excerpt"]//text()'
+
def request(query, params):
params['url'] = search_url + urlencode({'q': query})
@@ -20,6 +22,6 @@ def response(resp):
link = result.xpath('.//div[@class="result-link"]//a')[0]
href = urljoin(url, link.attrib.get('href'))
title = escape(' '.join(link.xpath('.//text()')))
- content = escape(' '.join(result.xpath('.//div[@class="excerpt"]//text()')))
+ content = escape(' '.join(result.xpath(result_xpath)))
results.append({'url': href, 'title': title, 'content': content})
return results