on master help sign in
[mod] unused imports and whitespaces purged
commitd13c5aa37b02e4df8d5aa7481d0fece3a341f8c2 authorasciimoo <asciimoo@gmail.com> dateSun 5 Jan 2014, 00:46 (13 years ago) parent27cae54
2 files changed+9−11
searx/engines/filecrop.py+4−6 searx/engines/yacy.py+5−5
searx/engines/filecrop.py+4−6
@@ -1,6 +1,4 @@
1−from json import loads
21from urllib import urlencode
3−from searx.utils import html_to_text
42from HTMLParser import HTMLParser
53
64url = 'http://www.filecrop.com/'
@@ -10,7 +8,7 @@ class FilecropResultParser(HTMLParser):
108 def __init__(self):
119 HTMLParser.__init__(self)
1210 self.__start_processing = False
13−
11+
1412 self.results = []
1513 self.result = {}
1614
@@ -22,7 +20,7 @@ class FilecropResultParser(HTMLParser):
2220 if tag == 'tr':
2321 if ('bgcolor', '#edeff5') in attrs or ('bgcolor', '#ffffff') in attrs:
2422 self.__start_processing = True
25−
23+
2624 if not self.__start_processing:
2725 return
2826
@@ -50,7 +48,7 @@ class FilecropResultParser(HTMLParser):
5048 self.data_counter = 0
5149 self.results.append(self.result)
5250 self.result = {}
53−
51+
5452 def handle_data(self, data):
5553 if not self.__start_processing:
5654 return
@@ -59,7 +57,7 @@ class FilecropResultParser(HTMLParser):
5957 self.result['content'] += data + ' '
6058 else:
6159 self.result['content'] = data + ' '
62−
60+
6361 self.data_counter += 1
6462
6563def request(query, params):
searx/engines/yacy.py+5−5
@@ -1,5 +1,5 @@
11from json import loads
2−from urllib import urlencode, quote
2+from urllib import urlencode
33
44url = 'http://localhost:8090'
55search_url = '/yacysearch.json?{query}&maximumRecords=10'
@@ -10,7 +10,7 @@ def request(query, params):
1010
1111def response(resp):
1212 raw_search_results = loads(resp.text)
13−
13+
1414 if not len(raw_search_results):
1515 return []
1616
@@ -22,10 +22,10 @@ def response(resp):
2222 tmp_result = {}
2323 tmp_result['title'] = result['title']
2424 tmp_result['url'] = result['link']
25− tmp_result['content'] = ''
26−
25+ tmp_result['content'] = ''
26+
2727 if len(result['description']):
28− tmp_result['content'] += result['description'] +"<br/>"
28+ tmp_result['content'] += result['description'] +"<br/>"
2929
3030 if len(result['pubDate']):
3131 tmp_result['content'] += result['pubDate'] + "<br/>"