diff options
author | dalf <alex@al-f.net> | 2015-02-12 12:30:03 +0100 |
---|---|---|
committer | dalf <alex@al-f.net> | 2015-02-12 14:30:03 +0100 |
commit | 9db0bbc30421cec9d42438ccab748439eea60105 (patch) | |
tree | 1da63f3ee4af003e6da5b1a59c9c27a700ca16d0 /searx/engines | |
parent | f8a5f7d6751ad72c877d6008f1a7d9792ba911f6 (diff) | |
download | searxng-9db0bbc30421cec9d42438ccab748439eea60105.tar.gz searxng-9db0bbc30421cec9d42438ccab748439eea60105.zip |
[fix] kickass engine : change the hostname to kickass.to (since kickass.so doesn't respond).
Close #197 perhaps not in clean way. Explanation :
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 beginning 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
Diffstat (limited to 'searx/engines')
-rw-r--r-- | searx/engines/kickass.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/searx/engines/kickass.py b/searx/engines/kickass.py index 8b89e1f47..8b7e24579 100644 --- a/searx/engines/kickass.py +++ b/searx/engines/kickass.py @@ -20,7 +20,7 @@ categories = ['videos', 'music', 'files'] paging = True # search-url -url = 'https://kickass.so/' +url = 'https://kickass.to/' search_url = url + 'search/{search_term}/{pageno}/' # specific xpath variables @@ -45,6 +45,11 @@ def request(query, params): def response(resp): results = [] + # check if redirect comparing to the True value, + # because resp can be a Mock object, and any attribut name returns something. + if resp.is_redirect == True: + return results + dom = html.fromstring(resp.text) search_res = dom.xpath('//table[@class="data"]//tr') |