on master help sign in
[fix] proper html escaping
commite47258ce38fe4313a5a6881c54bd9fb14c8619c7 authorasciimoo <asciimoo@gmail.com> dateThu 17 Oct 2013, 20:43 (13 years ago) parent4883929
1 file changed+2−1
searx/engines/stackoverflow.py+2−1
searx/engines/stackoverflow.py+2−1
@@ -1,6 +1,7 @@
11from urllib import quote
22from lxml import html
33from urlparse import urljoin
4+from cgi import escape
45
56base_url = 'http://stackoverflow.com/'
67search_url = base_url+'search?q='
@@ -20,6 +21,6 @@ def response(resp):
2021 link = result.xpath('.//div[@class="result-link"]//a')[0]
2122 url = urljoin(base_url, link.attrib.get('href'))
2223 title = ' '.join(link.xpath('.//text()'))
23− content = ' '.join(result.xpath('.//div[@class="excerpt"]//text()'))
24+ content = escape(' '.join(result.xpath('.//div[@class="excerpt"]//text()')))
2425 results.append({'url': url, 'title': title, 'content': content})
2526 return results