Browse Source

Fix for 1337 magnet crawler

Included from the wrong location and used the wrong curl variable.
Arnan de Gans 1 year ago
parent
commit
14745e63b2
4 changed files with 20 additions and 24 deletions
  1. 2 4
      config.php
  2. 16 17
      engines/torrent/magnetize_1337x.php
  3. 1 3
      help.php
  4. 1 0
      readme.md

+ 2 - 4
config.php

@@ -74,7 +74,7 @@ TORRENT TRACKERS:
 ------------------------------------------------------------------------------------ */
 
 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 @@ return (object) array(
     	"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"
+    )
 );
 ?>

+ 16 - 17
engines/torrent/magnetize_1337x.php

@@ -1,5 +1,5 @@
 <?php
-require "../../misc/tools.php";
+require "../../functions/tools.php";
 $opts = require "../../config.php";
 
 /* ------------------------------------------------------------------------------------
@@ -15,24 +15,24 @@ $opts = require "../../config.php";
 
 $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);
@@ -42,8 +42,7 @@ $xpath = get_xpath($response);
 // 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")
 ?>

+ 1 - 3
help.php

@@ -107,8 +107,6 @@ if(verify_hash($opts, $auth)) {
 			<?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>
@@ -122,7 +120,7 @@ if(verify_hash($opts, $auth)) {
 
 <?php 
 } else {
-	echo "<div class=\"auth-error\">Nope, go away!</div>";
+	echo "<div class=\"auth-error\">Goosle</div>";
 } 
 ?>
 </body>

+ 1 - 0
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.