on master help sign in
[mod] unused imports and whitespaces purged
d13c5aaasciimoo
searx/engines/filecrop.py+4−6
@@ -1,6 +1,4 @@
1−from json import loads
2from urllib import urlencode
1from urllib import urlencode
3−from searx.utils import html_to_text
4from HTMLParser import HTMLParser
2from HTMLParser import HTMLParser
5
3
6url = 'http://www.filecrop.com/'
4url = 'http://www.filecrop.com/'
@@ -10,7 +8,7 @@ class FilecropResultParser(HTMLParser):
10 def __init__(self):
8 def __init__(self):
11 HTMLParser.__init__(self)
9 HTMLParser.__init__(self)
12 self.__start_processing = False
10 self.__start_processing = False
13−
11+
14 self.results = []
12 self.results = []
15 self.result = {}
13 self.result = {}
16
14
@@ -22,7 +20,7 @@ class FilecropResultParser(HTMLParser):
22 if tag == 'tr':
20 if tag == 'tr':
23 if ('bgcolor', '#edeff5') in attrs or ('bgcolor', '#ffffff') in attrs:
21 if ('bgcolor', '#edeff5') in attrs or ('bgcolor', '#ffffff') in attrs:
24 self.__start_processing = True
22 self.__start_processing = True
25−
23+
26 if not self.__start_processing:
24 if not self.__start_processing:
27 return
25 return
28
26
@@ -50,7 +48,7 @@ class FilecropResultParser(HTMLParser):
50 self.data_counter = 0
48 self.data_counter = 0
51 self.results.append(self.result)
49 self.results.append(self.result)
52 self.result = {}
50 self.result = {}
53−
51+
54 def handle_data(self, data):
52 def handle_data(self, data):
55 if not self.__start_processing:
53 if not self.__start_processing:
56 return
54 return
@@ -59,7 +57,7 @@ class FilecropResultParser(HTMLParser):
59 self.result['content'] += data + ' '
57 self.result['content'] += data + ' '
60 else:
58 else:
61 self.result['content'] = data + ' '
59 self.result['content'] = data + ' '
62−
60+
63 self.data_counter += 1
61 self.data_counter += 1
64
62
65def request(query, params):
63def request(query, params):
searx/engines/yacy.py+5−5
@@ -1,5 +1,5 @@
1from json import loads
1from json import loads
2−from urllib import urlencode, quote
2+from urllib import urlencode
3
3
4url = 'http://localhost:8090'
4url = 'http://localhost:8090'
5search_url = '/yacysearch.json?{query}&maximumRecords=10'
5search_url = '/yacysearch.json?{query}&maximumRecords=10'
@@ -10,7 +10,7 @@ def request(query, params):
10
10
11def response(resp):
11def response(resp):
12 raw_search_results = loads(resp.text)
12 raw_search_results = loads(resp.text)
13−
13+
14 if not len(raw_search_results):
14 if not len(raw_search_results):
15 return []
15 return []
16
16
@@ -22,10 +22,10 @@ def response(resp):
22 tmp_result = {}
22 tmp_result = {}
23 tmp_result['title'] = result['title']
23 tmp_result['title'] = result['title']
24 tmp_result['url'] = result['link']
24 tmp_result['url'] = result['link']
25− tmp_result['content'] = ''
25+ tmp_result['content'] = ''
26−
26+
27 if len(result['description']):
27 if len(result['description']):
28− tmp_result['content'] += result['description'] +"<br/>"
28+ tmp_result['content'] += result['description'] +"<br/>"
29
29
30 if len(result['pubDate']):
30 if len(result['pubDate']):
31 tmp_result['content'] += result['pubDate'] + "<br/>"
31 tmp_result['content'] += result['pubDate'] + "<br/>"