diff --git a/README.md b/README.md
index 9fcbb6d..1a8e5d3 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@
| Clearnet | TOR | I2P | Country |
|-|-|-|-|
-| [search.femboy.hu](https://search.femboy.hu/) | [β
](http://search.femboy2vec5mc3rdvecifqrwzpiaeoyfh4zodppxq4pc2tdvzhm4moqd.onion/) | β | ππΊ HU (OFFICIAL INSTANCE) |
+| [search.femboy.hu](https://search.femboy.hu/) | [β
](http://search.cepyxplublbyw2f4axy4pyztfbxmf63lrt2c7uwv6wl4iixz53czload.onion/) | β | ππΊ HU (OFFICIAL INSTANCE) |
| [lx.vern.cc](https://lx.vern.cc/) | [β
](http://lx.vernccvbvyi5qhfzyqengccj7lkove6bjot2xhh5kajhwvidqafczrad.onion/) | [β
](http://vernziqfqvweijfaacmwazohgpdo2bt2ib2jlupt2pwwu27bhgxq.b32.i2p/) | πΊπΈ US |
| [lx.sesu.cc](https://lx.sesu.cc/) | [β
](http://lx.swxoebbpeqiiixyhbuh3vbw53pdrmtbiaj2sqveol6kkn5rpapfi4aad.onion/) | [β
](http://lqbchqljxiwl3bbjt4vqe76luovk5ly6khqhg7mt5qcqfn6e4sbq.b32.i2p/) | π¨π± CL |
| [librex.mikata.ru](https://librex.mikata.ru/) | [β
](http://f7ssz7l3biu4fugwctfpcx4txg5yq4gqhrt473ledsuc3ivtd3omniid.onion/) | β | πΊπΈ US |
@@ -43,7 +43,7 @@ Huge thanks to Richard Stallman for using LibreX and featuring it on his [websit
### About LibreX
-LibreX gives you results from Google, Brave, Qwant, Ahmia and popular torrent sites without spying on you.
+LibreX gives you results from Google, Qwant, Ahmia and popular torrent sites without spying on you.
If you would like to learn more about LibreX check out the [Wiki](https://github.com/hnhx/librex/wiki).
diff --git a/api.php b/api.php
index 81338f4..9938333 100644
--- a/api.php
+++ b/api.php
@@ -34,7 +34,7 @@
$results = get_image_results($query_encoded, $page);
break;
case 2:
- require "engines/brave/video.php";
+ require "engines/invidious/video.php";
$results = get_video_results($query_encoded);
break;
case 3:
diff --git a/config.php.example b/config.php.example
index b49f788..7075547 100644
--- a/config.php.example
+++ b/config.php.example
@@ -7,6 +7,9 @@
// Google results will be in this language
"google_language" => "en",
+ // If you have a local instance you can change this to http://localhost:3000
+ "invidious_instance_for_video_results" => "https://invidious.namazso.eu",
+
"disable_bittorent_search" => false,
"bittorent_trackers" => "&tr=http%3A%2F%2Fnyaa.tracker.wf%3A7777%2Fannounce&tr=udp%3A%2F%2Fopen.stealth.si%3A80%2Fannounce&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannounce&tr=udp%3A%2F%2Fexodus.desync.com%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.torrent.eu.org%3A451%2Fannounce",
@@ -49,7 +52,7 @@
// CURLOPT_PROXYTYPE => CURLPROXY_HTTP,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
- CURLOPT_USERAGENT => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36",
+ CURLOPT_USERAGENT => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_PROTOCOLS => CURLPROTO_HTTPS | CURLPROTO_HTTP,
diff --git a/donate.php b/donate.php
index 3a23b9e..6e2915e 100644
--- a/donate.php
+++ b/donate.php
@@ -15,8 +15,6 @@
Monero (XMR):
41dGQr9EwZBfYBY3fibTtJZYfssfRuzJZDSVDeneoVcgckehK3BiLxAV4FvEVJiVqdiW996zvMxhFB8G8ot9nBFqQ84VkuC
- Liberapay
- liberapay.com/hnhx
diff --git a/engines/brave/video.php b/engines/brave/video.php
deleted file mode 100644
index f86523f..0000000
--- a/engines/brave/video.php
+++ /dev/null
@@ -1,65 +0,0 @@
-query("//div[@id='results']//div[@class='card']") as $result)
- {
- $url = $xpath->evaluate(".//a/@href", $result)[0]->textContent;
- $title = $xpath->evaluate(".//div/@title", $result)[0]->textContent;
- $views = $xpath->evaluate(".//div/@title", $result)[1]->textContent;
- $date = $xpath->evaluate(".//div//span", $result)[0]->textContent;
- $thumbnail_raw1 = $xpath->evaluate(".//div/@style", $result)[0]->textContent;
- $thumbnail_raw2 = explode("url('", $thumbnail_raw1)[1];
- $thumbnail = explode("'), url", $thumbnail_raw2)[0];
-
- $url = check_for_privacy_frontend($url);
-
- array_push($results,
- array (
- "title" => htmlspecialchars($title),
- "url" => htmlspecialchars($url),
- "base_url" => htmlspecialchars(get_base_url($url)),
- "views" => htmlspecialchars($views),
- "date" => htmlspecialchars($date),
- "thumbnail" => htmlspecialchars($thumbnail)
- )
- );
- }
-
- return $results;
- }
-
- function print_video_results($results)
- {
- echo "";
-
- foreach($results as $result)
- {
- $title = $result["title"];
- $url = $result["url"];
- $base_url = $result["base_url"];
- $views = $result["views"];
- $date = $result["date"];
- $thumbnail = $result["thumbnail"];
-
- echo "
";
- }
-
- echo "
";
- }
-?>
diff --git a/engines/google/text.php b/engines/google/text.php
index b406b32..d3520a9 100644
--- a/engines/google/text.php
+++ b/engines/google/text.php
@@ -10,7 +10,12 @@
$domain = $config->google_domain;
$language = isset($_COOKIE["google_language"]) ? htmlspecialchars($_COOKIE["google_language"]) : $config->google_language;
- $url = "https://www.google.$domain/search?&q=$query_encoded&start=$page&hl=$language&lr=lang_$language";
+ $url = "https://www.google.$domain/search?&q=$query_encoded&start=$page";
+
+ if (3 > strlen($language))
+ {
+ $url .= "&hl=$language&lr=lang_$language";
+ }
if (isset($_COOKIE["safe_search"]))
{
diff --git a/engines/invidious/video.php b/engines/invidious/video.php
new file mode 100644
index 0000000..2c0b731
--- /dev/null
+++ b/engines/invidious/video.php
@@ -0,0 +1,70 @@
+invidious_instance_for_video_results;
+
+ $url = "$instance_url/api/v1/search?q=$query";
+ $response = request($url);
+ $json_response = json_decode($response, true);
+
+ $results = array();
+
+ foreach ($json_response as $response)
+ {
+ if ($response["type"] == "video")
+ {
+ $title = $response["title"];
+ $url = $instance_url . "/watch?v=" . $response["videoId"];
+ $url = check_for_privacy_frontend($url);
+ $uploader = $response["author"];
+ $views = $response["viewCount"];
+ $date = $response["publishedText"];
+ $thumbnail = $instance_url . "/vi/" . explode("/vi/" ,$response["videoThumbnails"][4]["url"])[1];
+
+ array_push($results,
+ array (
+ "title" => htmlspecialchars($title),
+ "url" => htmlspecialchars($url),
+ "base_url" => htmlspecialchars(get_base_url($url)),
+ "uploader" => htmlspecialchars($uploader),
+ "views" => htmlspecialchars($views),
+ "date" => htmlspecialchars($date),
+ "thumbnail" => htmlspecialchars($thumbnail)
+ )
+ );
+ }
+ }
+
+ return $results;
+ }
+
+ function print_video_results($results)
+ {
+ echo "";
+
+ foreach($results as $result)
+ {
+ $title = $result["title"];
+ $url = $result["url"];
+ $base_url = $result["base_url"];
+ $uploader = $result["uploader"];
+ $views = $result["views"];
+ $date = $result["date"];
+ $thumbnail = $result["thumbnail"];
+
+ echo "
";
+ }
+
+ echo "
";
+ }
+?>
diff --git a/favicon.ico b/favicon.ico
index f1412a9..c0231ea 100644
Binary files a/favicon.ico and b/favicon.ico differ
diff --git a/image_proxy.php b/image_proxy.php
index 4f0a8d4..e0004b4 100644
--- a/image_proxy.php
+++ b/image_proxy.php
@@ -4,16 +4,11 @@
require "misc/tools.php";
$url = $_REQUEST["url"];
+ $requested_root_domain = get_root_domain($url);
- $split_url = explode("/", $url);
- $base_url = $split_url[2];
+ $allowed_domains = array("qwant.com", "wikimedia.org", get_root_domain($config->invidious_instance_for_video_results));
- $base_url_main_split = explode(".", strrev($base_url));
- $base_url_main = strrev($base_url_main_split[1]) . "." . strrev($base_url_main_split[0]);
-
- $allowed_domains = array("qwant.com", "wikimedia.org", "brave.com");
-
- if (in_array($base_url_main, $allowed_domains))
+ if (in_array($requested_root_domain, $allowed_domains))
{
$image = $url;
$image_src = request($image);
diff --git a/instances.json b/instances.json
index e7b18e9..6badd79 100644
--- a/instances.json
+++ b/instances.json
@@ -2,7 +2,7 @@
"instances": [
{
"clearnet": "https://search.femboy.hu/",
- "tor": "http://librex.2356uhnbpv5nk3bni5bv6jg2cd6lgj664kwx3lhyelstpttpyv4kk2qd.onion/",
+ "tor": "http://search.cepyxplublbyw2f4axy4pyztfbxmf63lrt2c7uwv6wl4iixz53czload.onion/",
"i2p": null,
"country": "HU"
},
@@ -35,7 +35,7 @@
"tor": "http://5yblccekvswxl4n43bn5eg4pr7c4xygvu5lhhdb6ulzmislvahmhitad.onion",
"i2p": null,
"country": "PL"
- }
+ },
{
"clearnet": "https://search.davidovski.xyz/",
"tor": null,
diff --git a/misc/tools.php b/misc/tools.php
index bafb063..0e002c9 100644
--- a/misc/tools.php
+++ b/misc/tools.php
@@ -6,6 +6,17 @@
return $base_url;
}
+ function get_root_domain($url)
+ {
+ $split_url = explode("/", $url);
+ $base_url = $split_url[2];
+
+ $base_url_main_split = explode(".", strrev($base_url));
+ $root_domain = strrev($base_url_main_split[1]) . "." . strrev($base_url_main_split[0]);
+
+ return $root_domain;
+ }
+
function try_replace_with_frontend($url, $frontend, $original)
{
$config = require "config.php";
diff --git a/opensearch.xml.example b/opensearch.xml.example
index fac6052..5297550 100644
--- a/opensearch.xml.example
+++ b/opensearch.xml.example
@@ -1,11 +1,11 @@
LibreX
- A privacy respecting meta search engine.
+ Framework and javascript free privacy respecting meta search engine
UTF-8
LibreX search
-
+
+ template="/opensearch.xml?method=GET" />
diff --git a/search.php b/search.php
index 33c7659..3bd3e48 100644
--- a/search.php
+++ b/search.php
@@ -89,7 +89,7 @@
break;
case 2:
- require "engines/brave/video.php";
+ require "engines/invidious/video.php";
$results = get_video_results($query_encoded);
print_elapsed_time($start_time);
print_video_results($results);