diff --git a/config.php b/config.php index abe9327..2f76a4c 100755 --- a/config.php +++ b/config.php @@ -17,12 +17,14 @@ Online invidious instances: https://docs.invidious.io/Invidious-Instances.md Online bibliogram instances: https://git.sr.ht/~cadence/bibliogram-docs/tree/master/docs/Instances.md Online nitter instances: https://github.com/zedeus/nitter/wiki/Instances + Online libreddit instances: https://github.com/spikecodes/libreddit Set as null or 0 if you don't want to replace results */ $config_replace_youtube_with_invidious = "https://yewtu.be"; $config_replace_instagram_with_bibliogram = "https://bibliogram.pussthecat.org"; $config_replace_twitter_with_nitter = "https://nitter.namazso.eu"; + $config_replace_reddit_with_libreddit = "https://libreddit.dothq.co"; /* To send requests trough a proxy uncomment CURLOPT_PROXY and CURLOPT_PROXYTYPE: diff --git a/engines/google/text.php b/engines/google/text.php index e5c8d9a..88ea500 100644 --- a/engines/google/text.php +++ b/engines/google/text.php @@ -18,7 +18,7 @@ return 0; } - function get_text_results($query, $page=0, $api=false) + function get_text_results($query, $page=0) { require "config.php"; require "misc/tools.php"; @@ -66,23 +66,28 @@ curl_multi_exec($mh, $running); } while ($running); - if ($special_search != 0 && $api == false) + if ($special_search != 0) { + $special_result = null; + switch ($special_search) { case 1: require "engines/special/currency.php"; - array_push($results, currency_results($query, curl_multi_getcontent($special_ch))); + $special_result = currency_results($query, curl_multi_getcontent($special_ch)); break; case 2: require "engines/special/definition.php"; - array_push($results, definition_results($query, curl_multi_getcontent($special_ch))); + $special_result = definition_results($query, curl_multi_getcontent($special_ch)); break; case 3: require "engines/special/wikipedia.php"; - array_push($results, wikipedia_results($query, curl_multi_getcontent($special_ch))); + $special_result = wikipedia_results($query, curl_multi_getcontent($special_ch)); break; } + + if ($special_result != null) + array_push($results, $special_result); } $xpath = get_xpath(curl_multi_getcontent($google_ch)); diff --git a/misc/tools.php b/misc/tools.php index f5304d4..1e1553f 100644 --- a/misc/tools.php +++ b/misc/tools.php @@ -21,6 +21,8 @@ } else if ($config_replace_twitter_with_nitter != null && strpos($url, "twitter.com")) $url = $config_replace_twitter_with_nitter . explode("twitter.com", $url)[1]; + else if ($config_replace_reddit_with_libreddit != null && strpos($url, "reddit.com")) + $url = $config_replace_reddit_with_libreddit . explode("reddit.com", $url)[1]; return $url; }