Advertisement
Guest User

Untitled

a guest
Jan 27th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.33 KB | None | 0 0
  1. <?PHP
  2.  
  3. $servername = "192.168.2.75";
  4. $username = "kodi";
  5. $password = "kodi";
  6. $dbname = "torrents";
  7.  
  8. // Create connection
  9. $conn = new mysqli($servername, $username, $password, $dbname);
  10.  
  11. // Check connection
  12. if ($conn->connect_error) {
  13. die("Connection failed: " . $conn->connect_error);
  14. }
  15.  
  16.  
  17. #INITIAL SCRAPE OF PAGE
  18. $initial_results = array();
  19. $url="https://1337x.unblocked.vc/user/QxR/";
  20. #$url="https://1337x.unblocked.vc/QxR-torrents/2/";
  21. $data=file_get_contents($url);
  22. $data = strip_tags($data,"<a>");
  23. $d = preg_split("/<\/a>/",$data);
  24. foreach ( $d as $k=>$u ){
  25. if( strpos($u, "<a href=") !== FALSE ){
  26. $u = preg_replace("/.*<a\s+href=\"/sm","",$u);
  27. $u = preg_replace("/\".*/","",$u);
  28. if( strpos($u, '/torrent/') !== FALSE) {
  29. array_push($initial_results, $u);
  30. }
  31. }
  32. }
  33.  
  34. #LOOP TO GRAB INFO FROM PAGES
  35. $reversed = array_reverse($initial_results);
  36. foreach ($reversed as $result){
  37. $title_split = explode("/", $result);
  38. $title = "'".$title_split[3]."'";
  39. $encoder=substr($title, 0, -5);
  40. $encoder="'".end(explode('-',$encoder))."'";
  41. print "TITLE: " . $title . "<br>";
  42. $url="https://1337x.unblocked.vc".$result;
  43. print "URL: <a href='" . $url . "'>" . $url . "</a><br>";
  44. $data=file_get_contents($url);
  45. $data = strip_tags($data,"<a>");
  46. $d = preg_split("/<\/a>/",$data);
  47. foreach ( $d as $k=>$u ){
  48. if( strpos($u, "href=\"magnet") !== FALSE ){
  49. $u = preg_replace("/.*href=\"/sm","",$u);
  50. $u = preg_replace("/\".*/","",$u);
  51. if( strpos($u, "magnet") !== FALSE ){
  52. print "MAGNET: <a href='" . $u . "'>MAGNET</a><br>";
  53. $start = "btih:";
  54. $end = "&dn";
  55. $hash = "'".getBetween($u,$start,$end)."'";
  56. print "HASH: " . $hash . "<br>";
  57. print "ENCODER: " . $encoder . "<br>";
  58. $check_select = mysqli_query("SELECT * FROM `qxr` WHERE title = '$title'");
  59. $numrows=mysqli_num_rows($check_select);
  60.  
  61. if($numrows == 0){
  62.  
  63. $sql = "INSERT INTO qxr (title,hash,encoder) VALUES ($title, $hash, $encoder)";
  64. $conn->query($sql);
  65. }
  66. else
  67. {print "Record exists";}
  68. break;
  69. }
  70. }
  71. }
  72.  
  73. }
  74.  
  75. function getBetween($content,$start,$end){
  76. $r = explode($start, $content);
  77. if (isset($r[1])){
  78. $r = explode($end, $r[1]);
  79. return $r[0];
  80. }
  81. return '';
  82. }
  83.  
  84. $conn->close();
  85.  
  86. ?>
  87.  
  88. hello
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement