Update the method relay_web_search

This commit is contained in:
Namhyeon Go 2024-11-08 06:17:26 +09:00
parent 0791e79be9
commit 75aec1d8bf
2 changed files with 9 additions and 3 deletions

View File

@ -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"
), "");
}
}

View File

@ -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");
}