From 8d5a78bbb877be1d8876a8a936badfb46b437ae9 Mon Sep 17 00:00:00 2001 From: davidovski Date: Sat, 30 Dec 2023 14:17:48 +0000 Subject: [PATCH 1/3] cache the page number and language for text --- engines/text/text.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/text/text.php b/engines/text/text.php index 1d6bd9e1..e93d14a1 100644 --- a/engines/text/text.php +++ b/engines/text/text.php @@ -10,7 +10,7 @@ public function __construct($opts, $mh) { shuffle($this->engines); $this->query = $opts->query; - $this->cache_key = "text:" . $this->query; + $this->cache_key = "text:" . $this->query . "p" . $opts->page . "l" . $opts->language; $this->page = $opts->page; $this->opts = $opts; From 7e88bbfaf5e43c0a19c0114cc9aa5b133fcdb8d2 Mon Sep 17 00:00:00 2001 From: davidovski Date: Sat, 30 Dec 2023 14:32:59 +0000 Subject: [PATCH 2/3] Fix pages on qwant image search --- engines/bittorrent/thepiratebay.php | 4 ++-- engines/qwant/image.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/bittorrent/thepiratebay.php b/engines/bittorrent/thepiratebay.php index b674274e..583b9563 100644 --- a/engines/bittorrent/thepiratebay.php +++ b/engines/bittorrent/thepiratebay.php @@ -26,7 +26,7 @@ public function parse_results($response) { if ($name == "No results returned") break; - array_push($results, + array_push($results, array ( "size" => htmlspecialchars($size), "name" => htmlspecialchars($name), @@ -39,7 +39,7 @@ public function parse_results($response) { } return $results; - + } } ?> diff --git a/engines/qwant/image.php b/engines/qwant/image.php index da0ffe9b..78c85b7d 100644 --- a/engines/qwant/image.php +++ b/engines/qwant/image.php @@ -1,7 +1,7 @@ page * 5; // load 50 images per page $query = urlencode($this->query); return "https://api.qwant.com/v3/search/images?q=$query&t=images&count=50&locale=en_us&offset=$offset&device=desktop&tgp=3&safesearch=1"; } From 70fd43fc3f9b309b61eca3b06dce83044bbed24d Mon Sep 17 00:00:00 2001 From: davidovski Date: Sat, 30 Dec 2023 14:40:23 +0000 Subject: [PATCH 3/3] Fix typo in torrent search config option --- config.php.example | 4 ++-- docker/config.php | 4 ++-- misc/search_engine.php | 9 ++++++++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/config.php.example b/config.php.example index fe4e3442..5a259f03 100644 --- a/config.php.example +++ b/config.php.example @@ -11,8 +11,8 @@ // You can use any Invidious instance here "invidious_instance_for_video_results" => "https://invidious.snopyta.org", - "disable_bittorent_search" => false, - "bittorent_trackers" => "&tr=http://nyaa.tracker.wf:7777/announce&tr=udp://open.stealth.si:80/announce&tr=udp://tracker.opentrackr.org:1337/announce&tr=udp://exodus.desync.com:6969/announce&tr=udp://tracker.torrent.eu.org:451/announce", + "disable_bittorrent_search" => false, + "bittorrent_trackers" => "&tr=http://nyaa.tracker.wf:7777/announce&tr=udp://open.stealth.si:80/announce&tr=udp://tracker.opentrackr.org:1337/announce&tr=udp://exodus.desync.com:6969/announce&tr=udp://tracker.torrent.eu.org:451/announce", "disable_hidden_service_search" => false, diff --git a/docker/config.php b/docker/config.php index f82ee088..3eb1370d 100644 --- a/docker/config.php +++ b/docker/config.php @@ -5,8 +5,8 @@ "language" => "${CONFIG_LANGUAGE}", "number_of_results" => ${CONFIG_NUMBER_OF_RESULTS}, "invidious_instance_for_video_results" => "${CONFIG_INVIDIOUS_INSTANCE}", - "disable_bittorent_search" => ${CONFIG_DISABLE_BITTORRENT_SEARCH}, - "bittorent_trackers" => "${CONFIG_BITTORRENT_TRACKERS}", + "disable_bittorrent_search" => ${CONFIG_DISABLE_BITTORRENT_SEARCH}, + "bittorrent_trackers" => "${CONFIG_BITTORRENT_TRACKERS}", "disable_hidden_service_search" => ${CONFIG_HIDDEN_SERVICE_SEARCH}, "instance_fallback" => ${CONFIG_INSTANCE_FALLBACK}, "request_cooldown" => ${CONFIG_RATE_LIMIT_COOLDOWN}, diff --git a/misc/search_engine.php b/misc/search_engine.php index cba668c5..682282ba 100644 --- a/misc/search_engine.php +++ b/misc/search_engine.php @@ -62,6 +62,13 @@ public static function print_results($results, $opts) {} function load_opts() { $opts = require "config.php"; + # account for the old, misspelled options + if (isset($opts->disable_bittorent_search)) + $opts->disable_bittorrent_search = $opts->disable_bittorent_search; + + if (isset($opts->bittorent_trackers)) + $opts->bittorrent_trackers = $opts->bittorent_trackers; + $opts->request_cooldown ??= 25; $opts->cache_time ??= 25; @@ -124,7 +131,7 @@ function init_search($opts, $mh) { return new VideoSearch($opts, $mh); case 3: - if ($opts->disable_bittorent_search) { + if ($opts->disable_bittorrent_search) { echo "

" . TEXTS["feature_disabled"] . "

"; break; }