summaryrefslogtreecommitdiff
path: root/searx/engines/stackoverflow.py
diff options
context:
space:
mode:
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