From 75aec1d8bff79245ad809ebcac1bb51b886ac7be Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Fri, 8 Nov 2024 06:17:26 +0900 Subject: [PATCH] Update the method relay_web_search --- assets/php/index.php | 10 ++++++++-- console.html | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/assets/php/index.php b/assets/php/index.php index 85799ec..fa4ff29 100644 --- a/assets/php/index.php +++ b/assets/php/index.php @@ -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" ), ""); -} +} \ No newline at end of file diff --git a/console.html b/console.html index 644659d..5470652 100644 --- a/console.html +++ b/console.html @@ -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"); }