superb.php 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?php
  2. error_reporting(0);
  3. header('Content-Type: text/json;charset=UTF-8',true,200);
  4. $m3u8 = $_GET["m3u8"];
  5. $ts = $_GET["ts"];
  6. if(empty($m3u8) and empty($ts)){
  7. $data = curl("http://cookies.elementfx.com/superb/list.txt",1,"");
  8. $data = gzuncompress(base64_decode($data));
  9. $data = json_decode($data);
  10. $count = count($data);
  11. $pro = $_SERVER['HTTP_X_FORWARDED_PROTO'];
  12. if(empty($pro)){
  13. $pro = json_decode($_SERVER['HTTP_CF_VISITOR'],true)["scheme"];
  14. if(empty($pro)){
  15. $pro = "http";
  16. }}
  17. $self = $pro."://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
  18. for($i=0;$i<$count;$i++){
  19. if(substr($data[$i]->url,0,1) == "/"){
  20. $result.=str_replace("/","",$data[$i]->category)."_".$data[$i]->name.",".$self."?m3u8=".$data[$i]->url."\n";
  21. }}
  22. print_r($result);
  23. }
  24. if(!empty($m3u8) and empty($ts)){
  25. $host = file_get_contents("./host.txt");
  26. $uid = file_get_contents("./uid.txt");
  27. $token = file_get_contents("./token.txt");
  28. if(time() - filemtime("./token.txt") > 300){
  29. $info = curl("http://cookies.elementfx.com/superb/superb.php",1,"");
  30. $info = json_decode($info);
  31. $host = $info->host;
  32. $uid = $info->uid;
  33. $token = $info->token;
  34. file_put_contents("./host.txt",$host);
  35. file_put_contents("./uid.txt",$uid);
  36. file_put_contents("./token.txt",$token);
  37. }
  38. $url = $host.$m3u8;
  39. $pre = explode("/index",$url)[0];
  40. $header = array("User-Agent: Lavf/58.12.100","Accept: */*","Connection: keep-alive","Icy-MetaData: 1","userid: {$uid}","usertoken: {$token}","Cache-Control: no-cache","Pragma: no-cache");
  41. $data = curl($url,1,$header);
  42. $data = array_filter(explode("\n",$data));
  43. $count = count($data);
  44. $pro = $_SERVER['HTTP_X_FORWARDED_PROTO'];
  45. if(empty($pro)){
  46. $pro = json_decode($_SERVER['HTTP_CF_VISITOR'],true)["scheme"];
  47. if(empty($pro)){
  48. $pro = "http";
  49. }}
  50. $self = $pro."://".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'];
  51. for($i=0;$i<$count;$i++){
  52. if(substr($data[$i],0,1) !== "#"){
  53. $data[$i] = $self."?ts={$pre}/{$data[$i]}";
  54. }}
  55. print_r(implode("\n",$data));
  56. }
  57. if(empty($m3u8) and !empty($ts)){
  58. $uid = file_get_contents("./uid.txt");
  59. $token = file_get_contents("./token.txt");
  60. $header = array("User-Agent: Lavf/58.12.100","Accept: */*","Connection: keep-alive","Icy-MetaData: 1","userid: {$uid}","usertoken: {$token}","Cache-Control: no-cache","Pragma: no-cache");
  61. header("Content-Type: video/mp2t");
  62. header('Content-Disposition: attachment; filename=superb.ts');
  63. print_r(curl($ts,0,$header));
  64. }
  65. function curl($url,$type,$header){
  66. $ch = curl_init();
  67. curl_setopt($ch, CURLOPT_URL, $url);
  68. curl_setopt($ch, CURLOPT_RETURNTRANSFER, $type);
  69. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, False);
  70. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, False);
  71. if(!empty($header)){
  72. curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
  73. }
  74. $result = curl_exec($ch);
  75. curl_close($ch);
  76. return $result;
  77. }
  78. ?>