Skip to content

Commit

Permalink
Fix for 1337 magnet crawler
Browse files Browse the repository at this point in the history
Included from the wrong location and used the wrong curl variable.
  • Loading branch information
Arnan de Gans committed Dec 5, 2023
1 parent cd8a27e commit 14745e6
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 24 deletions.
6 changes: 2 additions & 4 deletions config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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"
)
);
?>
33 changes: 16 additions & 17 deletions engines/torrent/magnetize_1337x.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
require "../../misc/tools.php";
require "../../functions/tools.php";
$opts = require "../../config.php";

/* ------------------------------------------------------------------------------------
Expand All @@ -15,24 +15,24 @@

$ch = curl_init();

curl_setopt($this->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);
Expand All @@ -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")
?>
4 changes: 1 addition & 3 deletions help.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@
<?php } ?>

<p><small><strong>Acknowledgements:</strong><br />Goosle started as a fork of LibreY, and takes some design cues from DuckDuckGo.com. Goosle is created by <a href="https://ajdg.solutions/" target="_blank">Arnan de Gans</a>.</small></p>

<p><small><strong>Version:</strong> <?php echo $opts->version; ?> / <strong>Released:</strong> <?php echo $opts->released; ?></small></p>
</section>
</div>
</div>
Expand All @@ -122,7 +120,7 @@

<?php
} else {
echo "<div class=\"auth-error\">Nope, go away!</div>";
echo "<div class=\"auth-error\">Goosle</div>";
}
?>
</body>
Expand Down
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 14745e6

Please sign in to comment.