mirror of
https://github.com/gnh1201/caterpillar.git
synced 2024-11-26 07:21:46 +00:00
Update the method relay_web_search
This commit is contained in:
parent
0791e79be9
commit
75aec1d8bf
|
@ -490,8 +490,14 @@ function relay_invoke_method($params) {
|
|||
}
|
||||
|
||||
function relay_web_search($params) {
|
||||
$page = $params['page'];
|
||||
$search_params = array(
|
||||
"q" => $params['keyword'],
|
||||
"p" => ($page > 0 ? $page - 1 : 0),
|
||||
"t" => "0" // text only
|
||||
);
|
||||
$result = relay_fetch_url(array(
|
||||
"url" => "https://serp.catswords.net/api.php?" . http_build_query($params)
|
||||
"url" => "https://serp.catswords.net/api.php?" . http_build_query($search_params)
|
||||
));
|
||||
if ($result['success']) {
|
||||
return array(
|
||||
|
@ -632,4 +638,4 @@ if ($context['jsonrpc'] == "2.0") {
|
|||
"status" => 403,
|
||||
"message" => "Unsupported format"
|
||||
), "");
|
||||
}
|
||||
}
|
|
@ -471,7 +471,7 @@
|
|||
},
|
||||
prev: function() {
|
||||
if (env.method == "relay_web_search") {
|
||||
var num = (env.page > 1 ? parseInt(env.page) - 1 : 1);
|
||||
var num = (env.page > 1 ? env.page - 1 : 1);
|
||||
this.exec("set page " + num);
|
||||
this.exec("do");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user