From e47258ce38fe4313a5a6881c54bd9fb14c8619c7 Mon Sep 17 00:00:00 2001 From: asciimoo Date: Thu, 17 Oct 2013 20:43:05 +0200 Subject: [PATCH] [fix] proper html escaping --- searx/engines/stackoverflow.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/searx/engines/stackoverflow.py b/searx/engines/stackoverflow.py index fb0d65cdf..24afe9eac 100644 --- a/searx/engines/stackoverflow.py +++ b/searx/engines/stackoverflow.py @@ -1,6 +1,7 @@ from urllib import quote from lxml import html from urlparse import urljoin +from cgi import escape base_url = 'http://stackoverflow.com/' search_url = base_url+'search?q=' @@ -20,6 +21,6 @@ def response(resp): link = result.xpath('.//div[@class="result-link"]//a')[0] url = urljoin(base_url, link.attrib.get('href')) title = ' '.join(link.xpath('.//text()')) - content = ' '.join(result.xpath('.//div[@class="excerpt"]//text()')) + content = escape(' '.join(result.xpath('.//div[@class="excerpt"]//text()'))) results.append({'url': url, 'title': title, 'content': content}) return results