浏览代码

[fix] kickass engine : change the hostname to kickass.to (since kickass.so doesn't respond).

Close #197 perhaps not in clean way. Explaination :
In fact 301 responses are followed, except the hook is called for each HTTP response,
the first time for the HTTP 301 response then for HTTP 200 response.
Since the kickass engine excepts a real result, the engine crashes, AND the requests lib stops here.
Add a simple test at the begining of the result function allows pass the first response and handle correctly the second response (the real one)

May be a proper way is to add this test in search.py ?

Code inside requests :
https://github.com/kennethreitz/requests/blob/53d02381e22436b6d0757eb305eb1a960f82d361/requests/sessions.py#L579
and line 591
dalf 10 年前
父节点
当前提交
1cf870c024
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4
    1
      searx/engines/kickass.py

+ 4
- 1
searx/engines/kickass.py 查看文件

20
 paging = True
20
 paging = True
21
 
21
 
22
 # search-url
22
 # search-url
23
-url = 'https://kickass.so/'
23
+url = 'https://kickass.to/'
24
 search_url = url + 'search/{search_term}/{pageno}/'
24
 search_url = url + 'search/{search_term}/{pageno}/'
25
 
25
 
26
 # specific xpath variables
26
 # specific xpath variables
45
 def response(resp):
45
 def response(resp):
46
     results = []
46
     results = []
47
 
47
 
48
+    if resp.is_redirect:
49
+        return results
50
+
48
     dom = html.fromstring(resp.text)
51
     dom = html.fromstring(resp.text)
49
 
52
 
50
     search_res = dom.xpath('//table[@class="data"]//tr')
53
     search_res = dom.xpath('//table[@class="data"]//tr')