mirror of
https://github.com/searxng/searxng
synced 2024-01-01 18:24:07 +00:00
parent
8adc80123a
commit
0ad272c5cb
@ -9,6 +9,7 @@
|
|||||||
# @parse url, title, content, suggestion
|
# @parse url, title, content, suggestion
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
from cgi import escape
|
||||||
from urllib import urlencode
|
from urllib import urlencode
|
||||||
from urlparse import urlparse, parse_qsl
|
from urlparse import urlparse, parse_qsl
|
||||||
from lxml import html
|
from lxml import html
|
||||||
@ -167,7 +168,7 @@ def parse_url(url_string, google_hostname):
|
|||||||
def extract_text_from_dom(result, xpath):
|
def extract_text_from_dom(result, xpath):
|
||||||
r = result.xpath(xpath)
|
r = result.xpath(xpath)
|
||||||
if len(r) > 0:
|
if len(r) > 0:
|
||||||
return extract_text(r[0])
|
return escape(extract_text(r[0]))
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
@ -273,7 +274,7 @@ def response(resp):
|
|||||||
# parse suggestion
|
# parse suggestion
|
||||||
for suggestion in dom.xpath(suggestion_xpath):
|
for suggestion in dom.xpath(suggestion_xpath):
|
||||||
# append suggestion
|
# append suggestion
|
||||||
results.append({'suggestion': extract_text(suggestion)})
|
results.append({'suggestion': escape(extract_text(suggestion))})
|
||||||
|
|
||||||
# return results
|
# return results
|
||||||
return results
|
return results
|
||||||
|
Loading…
Reference in New Issue
Block a user