From 14745e63b223fca04ab1a23a43b4d97673eeab83 Mon Sep 17 00:00:00 2001 From: Arnan de Gans Date: Tue, 5 Dec 2023 17:56:16 -0600 Subject: [PATCH] Fix for 1337 magnet crawler Included from the wrong location and used the wrong curl variable. --- config.php | 6 ++---- engines/torrent/magnetize_1337x.php | 33 ++++++++++++++--------------- help.php | 4 +--- readme.md | 1 + 4 files changed, 20 insertions(+), 24 deletions(-) diff --git a/config.php b/config.php index 3c236db..54bf116 100644 --- a/config.php +++ b/config.php @@ -74,7 +74,7 @@ ------------------------------------------------------------------------------------ */ return (object) array( - "hash" => "blja-3jaq-34eg", + "hash" => "j9fg-i2du-er6m", "cache" => "off", "cache_time" => 30, // (Default: 30) "hash_auth" => "off", // Default: off) @@ -107,8 +107,6 @@ "udp://tracker.opentrackr.org:1337/announce", "udp://exodus.desync.com:6969/announce", "udp://tracker.torrent.eu.org:451/announce", - ), - "version" => "1.0", - "released" => "Nov 28, 2023" + ) ); ?> diff --git a/engines/torrent/magnetize_1337x.php b/engines/torrent/magnetize_1337x.php index 20658ac..acd0a08 100644 --- a/engines/torrent/magnetize_1337x.php +++ b/engines/torrent/magnetize_1337x.php @@ -1,5 +1,5 @@ ch, CURLOPT_URL, $_REQUEST["url"]); -curl_setopt($this->ch, CURLOPT_HTTPGET, 1); // Redundant? Probably... -curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, false); -curl_setopt($this->ch, CURLOPT_VERBOSE, false); -curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true); -curl_setopt($this->ch, CURLOPT_USERAGENT, $opts->user_agents[array_rand($opts->user_agents)]); -curl_setopt($this->ch, CURLOPT_HTTPHEADER, array( +curl_setopt($ch, CURLOPT_URL, $_REQUEST["url"]); +curl_setopt($ch, CURLOPT_HTTPGET, 1); // Redundant? Probably... +curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); +curl_setopt($ch, CURLOPT_VERBOSE, false); +curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); +curl_setopt($ch, CURLOPT_USERAGENT, $opts->user_agents[array_rand($opts->user_agents)]); +curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Language: en-US,en;q=0.5', 'Upgrade-Insecure-Requests: 1' )); -curl_setopt($this->ch, CURLOPT_ENCODING, "gzip,deflate"); -curl_setopt($this->ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_WHATEVER); -curl_setopt($this->ch, CURLOPT_PROTOCOLS, CURLPROTO_HTTPS | CURLPROTO_HTTP); -curl_setopt($this->ch, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTPS | CURLPROTO_HTTP); -curl_setopt($this->ch, CURLOPT_MAXREDIRS, 5); -curl_setopt($this->ch, CURLOPT_TIMEOUT, 3); -curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, true); +curl_setopt($ch, CURLOPT_ENCODING, "gzip,deflate"); +curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_WHATEVER); +curl_setopt($ch, CURLOPT_PROTOCOLS, CURLPROTO_HTTPS | CURLPROTO_HTTP); +curl_setopt($ch, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTPS | CURLPROTO_HTTP); +curl_setopt($ch, CURLOPT_MAXREDIRS, 5); +curl_setopt($ch, CURLOPT_TIMEOUT, 3); +curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); $response = curl_exec($ch); curl_close($ch); @@ -42,8 +42,7 @@ // No results if(!$xpath) die(); -$magnet = $xpath->query("//main/div/div/div/div/div/ul/li/a/@href")[0]->textContent; -$magnet = trim($magnet); +$magnet = trim($xpath->query("//main/div/div/div/div/div/ul/li/a/@href")[0]->textContent); header("Location: $magnet") ?> diff --git a/help.php b/help.php index 84bcb89..8c935f4 100644 --- a/help.php +++ b/help.php @@ -107,8 +107,6 @@

Acknowledgements:
Goosle started as a fork of LibreY, and takes some design cues from DuckDuckGo.com. Goosle is created by Arnan de Gans.

- -

Version: version; ?> / Released: released; ?>

@@ -122,7 +120,7 @@ Nope, go away!"; + echo "
Goosle
"; } ?> diff --git a/readme.md b/readme.md index d128ff0..5dd17d4 100644 --- a/readme.md +++ b/readme.md @@ -35,6 +35,7 @@ Tested to work on Apache with PHP8.2. 3. Upload all files to your webserver, for example to the root folder of a subdomain (eg. search.example.com) or a sub-folder on your main site (eg. example.com/search/) 4. Rename goosle.htaccess to .htaccess 5. Load the site in your browser. If you've enabled the access hash add ?a=YOURHASH to the url. +6. Let me know where you installed Goosle :-) ### Notes: - The .htaccess file has a redirect to force HTTPS as well as browser caching instructions ready to go.