mirror of
https://github.com/searxng/searxng.git
synced 2025-07-14 16:59:21 +02:00
fix: robot fw, entry points, some flake8, package searx egg
This commit is contained in:
parent
b7fa79081f
commit
dd4662978d
17 changed files with 293 additions and 130 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue