mirror of
https://github.com/searxng/searxng.git
synced 2025-12-23 04:00:02 +00:00
fix: robot fw, entry points, some flake8, package searx egg
This commit is contained in:
@@ -5,10 +5,12 @@ import codecs
|
||||
import cStringIO
|
||||
import re
|
||||
|
||||
|
||||
def gen_useragent():
|
||||
# TODO
|
||||
return "Mozilla/5.0 (X11; Linux x86_64; rv:26.0) Gecko/20100101 Firefox/26.0"
|
||||
|
||||
|
||||
def highlight_content(content, query):
|
||||
|
||||
if not content:
|
||||
@@ -34,10 +36,11 @@ def highlight_content(content, query):
|
||||
|
||||
return content
|
||||
|
||||
|
||||
class HTMLTextExtractor(HTMLParser):
|
||||
def __init__(self):
|
||||
HTMLParser.__init__(self)
|
||||
self.result = [ ]
|
||||
self.result = []
|
||||
|
||||
def handle_data(self, d):
|
||||
self.result.append(d)
|
||||
@@ -54,6 +57,7 @@ class HTMLTextExtractor(HTMLParser):
|
||||
def get_text(self):
|
||||
return u''.join(self.result)
|
||||
|
||||
|
||||
def html_to_text(html):
|
||||
s = HTMLTextExtractor()
|
||||
s.feed(html)
|
||||
|
||||
Reference in New Issue
Block a user