mirror of
https://github.com/searxng/searxng
synced 2024-01-01 18:24:07 +00:00
[mod] unused imports and whitespaces purged
This commit is contained in:
parent
27cae54197
commit
d13c5aa37b
@ -1,6 +1,4 @@
|
|||||||
from json import loads
|
|
||||||
from urllib import urlencode
|
from urllib import urlencode
|
||||||
from searx.utils import html_to_text
|
|
||||||
from HTMLParser import HTMLParser
|
from HTMLParser import HTMLParser
|
||||||
|
|
||||||
url = 'http://www.filecrop.com/'
|
url = 'http://www.filecrop.com/'
|
||||||
@ -10,7 +8,7 @@ class FilecropResultParser(HTMLParser):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
HTMLParser.__init__(self)
|
HTMLParser.__init__(self)
|
||||||
self.__start_processing = False
|
self.__start_processing = False
|
||||||
|
|
||||||
self.results = []
|
self.results = []
|
||||||
self.result = {}
|
self.result = {}
|
||||||
|
|
||||||
@ -22,7 +20,7 @@ class FilecropResultParser(HTMLParser):
|
|||||||
if tag == 'tr':
|
if tag == 'tr':
|
||||||
if ('bgcolor', '#edeff5') in attrs or ('bgcolor', '#ffffff') in attrs:
|
if ('bgcolor', '#edeff5') in attrs or ('bgcolor', '#ffffff') in attrs:
|
||||||
self.__start_processing = True
|
self.__start_processing = True
|
||||||
|
|
||||||
if not self.__start_processing:
|
if not self.__start_processing:
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -50,7 +48,7 @@ class FilecropResultParser(HTMLParser):
|
|||||||
self.data_counter = 0
|
self.data_counter = 0
|
||||||
self.results.append(self.result)
|
self.results.append(self.result)
|
||||||
self.result = {}
|
self.result = {}
|
||||||
|
|
||||||
def handle_data(self, data):
|
def handle_data(self, data):
|
||||||
if not self.__start_processing:
|
if not self.__start_processing:
|
||||||
return
|
return
|
||||||
@ -59,7 +57,7 @@ class FilecropResultParser(HTMLParser):
|
|||||||
self.result['content'] += data + ' '
|
self.result['content'] += data + ' '
|
||||||
else:
|
else:
|
||||||
self.result['content'] = data + ' '
|
self.result['content'] = data + ' '
|
||||||
|
|
||||||
self.data_counter += 1
|
self.data_counter += 1
|
||||||
|
|
||||||
def request(query, params):
|
def request(query, params):
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
from json import loads
|
from json import loads
|
||||||
from urllib import urlencode, quote
|
from urllib import urlencode
|
||||||
|
|
||||||
url = 'http://localhost:8090'
|
url = 'http://localhost:8090'
|
||||||
search_url = '/yacysearch.json?{query}&maximumRecords=10'
|
search_url = '/yacysearch.json?{query}&maximumRecords=10'
|
||||||
@ -10,7 +10,7 @@ def request(query, params):
|
|||||||
|
|
||||||
def response(resp):
|
def response(resp):
|
||||||
raw_search_results = loads(resp.text)
|
raw_search_results = loads(resp.text)
|
||||||
|
|
||||||
if not len(raw_search_results):
|
if not len(raw_search_results):
|
||||||
return []
|
return []
|
||||||
|
|
||||||
@ -22,10 +22,10 @@ def response(resp):
|
|||||||
tmp_result = {}
|
tmp_result = {}
|
||||||
tmp_result['title'] = result['title']
|
tmp_result['title'] = result['title']
|
||||||
tmp_result['url'] = result['link']
|
tmp_result['url'] = result['link']
|
||||||
tmp_result['content'] = ''
|
tmp_result['content'] = ''
|
||||||
|
|
||||||
if len(result['description']):
|
if len(result['description']):
|
||||||
tmp_result['content'] += result['description'] +"<br/>"
|
tmp_result['content'] += result['description'] +"<br/>"
|
||||||
|
|
||||||
if len(result['pubDate']):
|
if len(result['pubDate']):
|
||||||
tmp_result['content'] += result['pubDate'] + "<br/>"
|
tmp_result['content'] += result['pubDate'] + "<br/>"
|
||||||
|
Loading…
Reference in New Issue
Block a user