fix torrentgalaxy issue

This commit is contained in:
lamacchinadesiderante 2023-03-05 15:31:15 +01:00
parent d88cc62eca
commit b227556bb9
2 changed files with 33 additions and 27 deletions

View File

@ -8,7 +8,7 @@
"google_language" => "it", "google_language" => "it",
// If you have a local instance you can change this to http://localhost:3000 // If you have a local instance you can change this to http://localhost:3000
"invidious_instance_for_video_results" => "https://invidious.snopyta.org", "invidious_instance_for_video_results" => "https://invidious.copyriot.xyz",
"disable_bittorent_search" => false, "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", "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",
@ -19,14 +19,14 @@
Preset privacy friendly frontends for users, these can be overwritten by users in settings Preset privacy friendly frontends for users, these can be overwritten by users in settings
e.g.: "invidious" => "https://yewtu.be", e.g.: "invidious" => "https://yewtu.be",
*/ */
"invidious" => "https://invidious.snopyta.org", // youtube "invidious" => "https://invidious.copyriot.xyz", // youtube
"bibliogram" => "", // instagram "bibliogram" => "", // instagram
"rimgo" => "https://rimgo.pussthecat.org", // imgur "rimgo" => "https://rimgo.pussthecat.org", // imgur
"scribe" => "https://scribe.rip", // medium "scribe" => "https://scribe.rip", // medium
"librarian" => "", // odysee "librarian" => "", // odysee
"gothub" => "", // github "gothub" => "", // github
"nitter" => "https://nitter.pussthecat.org", // twitter "nitter" => "https://nitter.copyriot.xyz", // twitter
"libreddit" => "https://libreddit.kavin.rocks", // reddit "libreddit" => "https://libreddit.copyriot.xyz", // reddit
"proxitok" => "https://proxitok.pussthecat.org", // tiktok "proxitok" => "https://proxitok.pussthecat.org", // tiktok
"wikiless" => "", // wikipedia "wikiless" => "", // wikipedia
"quetre" => "https://quetre.pussthecat.org", // quora "quetre" => "https://quetre.pussthecat.org", // quora

View File

@ -4,31 +4,37 @@
function get_torrentgalaxy_results($response) function get_torrentgalaxy_results($response)
{ {
global $config; global $config;
$xpath = get_xpath($response);
$results = array();
foreach($xpath->query("//div[@class='tgxtablerow txlight']") as $result) try {
{ $xpath = get_xpath($response);
$name = $xpath->evaluate(".//div[contains(@class, 'clickable-row')]", $result)[0]->textContent; $results = array();
$magnet = $xpath->evaluate(".//div[@class='tgxtablecell collapsehide rounded txlight']/a/@href", $result)[1]->textContent;
$magnet_without_tracker = explode("&tr=", $magnet)[0]; foreach($xpath->query("//div[@class='tgxtablerow txlight']") as $result)
$magnet = $magnet_without_tracker . $config->bittorent_trackers; {
$size = $xpath->evaluate(".//div[@class='tgxtablecell collapsehide rounded txlight']/span", $result)[0]->textContent; $name = $xpath->evaluate(".//div[contains(@class, 'clickable-row')]", $result)[0]->textContent;
$seeders = $xpath->evaluate(".//div[@class='tgxtablecell collapsehide rounded txlight']/span/font", $result)[1]->textContent; $magnet = $xpath->evaluate(".//div[@class='tgxtablecell collapsehide rounded txlight']/a/@href", $result)[1]->textContent;
$leechers = $xpath->evaluate(".//div[@class='tgxtablecell collapsehide rounded txlight']/span/font", $result)[2]->textContent; $magnet_without_tracker = explode("&tr=", $magnet)[0];
$magnet = $magnet_without_tracker . $config->bittorent_trackers;
array_push($results, $size = $xpath->evaluate(".//div[@class='tgxtablecell collapsehide rounded txlight']/span", $result)[0]->textContent;
array ( $seeders = $xpath->evaluate(".//div[@class='tgxtablecell collapsehide rounded txlight']/span/font", $result)[1]->textContent;
"name" => htmlspecialchars($name), $leechers = $xpath->evaluate(".//div[@class='tgxtablecell collapsehide rounded txlight']/span/font", $result)[2]->textContent;
"seeders" => (int) $seeders,
"leechers" => (int) $leechers, array_push($results,
"magnet" => htmlspecialchars($magnet), array (
"size" => htmlspecialchars($size), "name" => htmlspecialchars($name),
"source" => "tgx.rs" "seeders" => (int) $seeders,
) "leechers" => (int) $leechers,
); "magnet" => htmlspecialchars($magnet),
"size" => htmlspecialchars($size),
"source" => "tgx.rs"
)
);
}
return $results;
} catch (Error $e) {
return array();
} }
return $results;
} }
?> ?>