浏览代码

[mod] unused imports and whitespaces purged

asciimoo 11 年前
父节点
当前提交
d13c5aa37b
共有 2 个文件被更改,包括 9 次插入11 次删除
  1. 4
    6
      searx/engines/filecrop.py
  2. 5
    5
      searx/engines/yacy.py

+ 4
- 6
searx/engines/filecrop.py 查看文件

1
-from json import loads
2
 from urllib import urlencode
1
 from urllib import urlencode
3
-from searx.utils import html_to_text
4
 from HTMLParser import HTMLParser
2
 from HTMLParser import HTMLParser
5
 
3
 
6
 url = 'http://www.filecrop.com/'
4
 url = 'http://www.filecrop.com/'
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
         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
                 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
             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
 
65
 def request(query, params):
63
 def request(query, params):

+ 5
- 5
searx/engines/yacy.py 查看文件

1
 from json import loads
1
 from json import loads
2
-from urllib import urlencode, quote
2
+from urllib import urlencode
3
 
3
 
4
 url = 'http://localhost:8090'
4
 url = 'http://localhost:8090'
5
 search_url = '/yacysearch.json?{query}&maximumRecords=10'
5
 search_url = '/yacysearch.json?{query}&maximumRecords=10'
10
 
10
 
11
 def response(resp):
11
 def 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
         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'] = '' 
26
-        
25
+        tmp_result['content'] = ''
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/>"