mirror of
https://github.com/searxng/searxng.git
synced 2024-12-29 20:50:28 +00:00
[fix] proper html escaping
This commit is contained in:
parent
48839295d3
commit
e47258ce38
1 changed files with 2 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue