1337x.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. $_1337x_url = "https://1337x.to/search/$query/1/";
  3. function get_1337x_results($response)
  4. {
  5. global $config;
  6. $xpath = get_xpath($response);
  7. $results = array();
  8. foreach($xpath->query("//table/tbody/tr") as $result)
  9. {
  10. $name = $xpath->evaluate(".//td[@class='coll-1 name']/a", $result)[1]->textContent;
  11. $magnet = "/engines/bittorrent/get_magnet_1337x.php?url=https://1337x.to" . $xpath->evaluate(".//td[@class='coll-1 name']/a/@href", $result)[1]->textContent;
  12. $size_unformatted = explode(" ", $xpath->evaluate(".//td[contains(@class, 'coll-4 size')]", $result)[0]->textContent);
  13. $size = $size_unformatted[0] . " " . preg_replace("/[0-9]+/", "", $size_unformatted[1]);
  14. $seeders = $xpath->evaluate(".//td[@class='coll-2 seeds']", $result)[0]->textContent;
  15. $leechers = $xpath->evaluate(".//td[@class='coll-3 leeches']", $result)[0]->textContent;
  16. array_push($results,
  17. array (
  18. "name" => htmlspecialchars($name),
  19. "seeders" => (int) $seeders,
  20. "leechers" => (int) $leechers,
  21. "magnet" => htmlspecialchars($magnet),
  22. "size" => htmlspecialchars($size),
  23. "source" => "1337x.to"
  24. )
  25. );
  26. }
  27. return $results;
  28. }
  29. ?>