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",
// 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,
"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
e.g.: "invidious" => "https://yewtu.be",
*/
"invidious" => "https://invidious.snopyta.org", // youtube
"invidious" => "https://invidious.copyriot.xyz", // youtube
"bibliogram" => "", // instagram
"rimgo" => "https://rimgo.pussthecat.org", // imgur
"scribe" => "https://scribe.rip", // medium
"librarian" => "", // odysee
"gothub" => "", // github
"nitter" => "https://nitter.pussthecat.org", // twitter
"libreddit" => "https://libreddit.kavin.rocks", // reddit
"nitter" => "https://nitter.copyriot.xyz", // twitter
"libreddit" => "https://libreddit.copyriot.xyz", // reddit
"proxitok" => "https://proxitok.pussthecat.org", // tiktok
"wikiless" => "", // wikipedia
"quetre" => "https://quetre.pussthecat.org", // quora

View File

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