Advertisement
Guest User

javhd

a guest
Oct 7th, 2017
3,035
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.35 KB | None | 0 0
  1. <?php
  2. function Cget($url,$ref=0) {
  3.     $headers = Array(
  4.     'Accept: image/gif, image/x-bitmap, image/jpeg, image/pjpeg',
  5.     'Connection: Keep-Alive',
  6.     'Accept: */*',
  7.     'Content-Type: application/x-www-form-urlencoded; charset=utf-8'
  8.     );
  9.     $process = curl_init($url);
  10.     curl_setopt($process, CURLOPT_HTTPHEADER, $headers);
  11.     curl_setopt($process, CURLOPT_HEADER, 0);
  12.     if($ref)
  13.     {
  14.         curl_setopt($process, CURLOPT_REFERER, $ref);
  15.     }
  16.     curl_setopt($process, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.75 Safari/537.36');
  17.     curl_setopt($process, CURLOPT_COOKIEFILE, realpath('cookie.txt'));
  18.     curl_setopt($process, CURLOPT_COOKIEJAR, realpath('cookie.txt'));
  19.     curl_setopt($process,CURLOPT_ENCODING , 'gzip');
  20.     curl_setopt($process, CURLOPT_TIMEOUT, 30);
  21.     curl_setopt($process, CURLOPT_SSL_VERIFYPEER, false);
  22.     curl_setopt($process, CURLOPT_RETURNTRANSFER, 1);
  23.     curl_setopt($process, CURLOPT_FOLLOWLOCATION, 1);
  24.     $return = curl_exec($process);
  25.     curl_close($process);
  26.     return $return;
  27. }
  28. function getLocation($url) {
  29.     $headers = Array(
  30.         'Accept: image/gif, image/x-bitmap, image/jpeg, image/pjpeg',
  31.         'Connection: Keep-Alive',
  32.         'Accept: */*',
  33.         'Content-Type: application/x-www-form-urlencoded; charset=utf-8'
  34.     );
  35.     $ch = curl_init($url);
  36.     curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  37.     curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.75 Safari/537.36');
  38.     curl_setopt($ch, CURLOPT_COOKIEFILE, realpath('cookie.txt'));
  39.     curl_setopt($ch, CURLOPT_COOKIEJAR, realpath('cookie.txt'));
  40.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
  41.     curl_setopt($ch, CURLOPT_HEADER, TRUE);
  42.     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, FALSE);
  43.     $response = curl_exec($ch);
  44.     preg_match_all('/^Location:(.*)$/mi', $response, $matches);
  45.     curl_close($ch);
  46.     return trim($matches[1][0]);
  47. }
  48. function Cpost($url,$data, $ref=0) {
  49.     $headers = Array(
  50.     'Accept: image/gif, image/x-bitmap, image/jpeg, image/pjpeg',
  51.     'Connection: Keep-Alive',
  52.     'Accept: */*',
  53.     'Content-Type: application/x-www-form-urlencoded; charset=utf-8'
  54.     );
  55.     $process = curl_init($url);
  56.     curl_setopt($process, CURLOPT_URL, $url);
  57.     curl_setopt($process, CURLOPT_HEADER, 1);
  58.     //curl_setopt($process, CURLOPT_COOKIESESSION, false);
  59.     curl_setopt($process, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.75 Safari/537.36');
  60.     curl_setopt($process, CURLOPT_COOKIEFILE, realpath('cookie.txt'));
  61.     curl_setopt($process, CURLOPT_COOKIEJAR, realpath('cookie.txt'));
  62.     curl_setopt($process, CURLOPT_SSL_VERIFYPEER, false);
  63.     if($ref)
  64.     {
  65.         curl_setopt($process, CURLOPT_REFERER, $ref);
  66.     }
  67.     curl_setopt($process,CURLOPT_ENCODING , 'gzip');
  68.     curl_setopt($process, CURLOPT_POSTFIELDS, $data);
  69.     curl_setopt($process, CURLOPT_RETURNTRANSFER, 1);
  70.     curl_setopt($process, CURLOPT_FOLLOWLOCATION, 1);
  71.     curl_setopt($process, CURLOPT_POST, 1);
  72.     $return = curl_exec($process);
  73.     curl_close($process);
  74.     return $return;
  75. }
  76. function explode_by($begin,$end,$data) {
  77.     $data = explode($begin,$data);
  78.     $data = explode($end,$data[1]);
  79.     return $data[0];
  80. }
  81. function getplayer($html,$thumb) {
  82.     $player = "<script type=\"text/javascript\" src=\"/jwplayer-7.12.3/jwplayer.js\"></script>
  83. <script>jwplayer.key = \"kVtDqPqOwahhlnOKSiNDPFJLsul6G4JQkmVdYO7jcPo=\";</script>";
  84.     $player .= '<div id="VHSPlugins"></div>
  85.         <script type="text/javascript">
  86.         jwplayer("VHSPlugins").setup({
  87.             sources: '.$html.',
  88.             width: "100%",
  89.             height: "100%",
  90.             controls: true,
  91.             autostart: false,
  92.             image: "'.$thumb.'",
  93.             allowfullscreen: true,
  94.             logo: {
  95.                 file: "https://assets-jpcust.jwpsrv.com/watermarks/S6ZL23Al.png",
  96.                 hide: true,
  97.                 link: "https://www.animehd.vn",
  98.                 margin: "15",
  99.                 position: "top-left"
  100.             },
  101.             preload: "auto",
  102.             sharing: {
  103.                 "sites": ["facebook", "twitter", "email"]
  104.             },
  105.             skin: {
  106.                 name: "seven"
  107.             }
  108.         });
  109.     </script>';
  110. echo $player;
  111. }
  112. //cache
  113. function cache($url,$expire){
  114.     $urlnew = str_replace(array(".","://","/"),array("_","_","_"),$url);
  115.     $dir = '/home/animehd.vn/public_html/javhd/cache/';
  116.     $file = '/home/animehd.vn/public_html/javhd/cache/'.$urlnew.'.txt';
  117.     if (!is_dir($dir)) {
  118.         mkdir($dir, 0777);
  119.     }
  120.     if(file_exists($file) && filemtime($file) > (time() - $expire))
  121.     {
  122.         $dataplay = file_get_contents($file);
  123.     }
  124.     else
  125.     {
  126.         $location = getLocation($url);
  127.         savecache($urlnew,$location);
  128.         $dataplay = $location;
  129.     }
  130.     return $dataplay;
  131. }
  132. function savecache($name,$dataplay)
  133. {  
  134.     $file = 'cache/'.$name.'.txt';
  135.     $fp = fopen($file, "w");
  136.     fputs($fp, $dataplay);
  137.     fclose($fp);
  138. }
  139. $user = "atxtqfmyft";
  140. $pass = "abdbaaawrg";
  141. $data = "login=$user&password=$pass&back=javhd.com&path=L2Vu";
  142. if(file_exists("cookie.txt") == 1) {
  143.     Cpost("https://secure.javhd.com/login/",$data);
  144. }
  145. //
  146. $url = $_GET["url"];
  147. preg_match('#https://javhd.com/en/id/(.*?)/#',$url,$matchurl);
  148. $id = $matchurl[1];
  149. $html = Cget("https://javhd.com/en/player/$id?type=vjs","https://secure.javhd.com/login/");
  150. $arr = json_decode($html,true);
  151. $image = $arr["poster"];
  152. for($i=0;$i<count($arr["sources"]);$i++) {
  153.     $jw[$i]["file"] = cache($arr["sources"][$i]["src"], 3600);
  154.     $jw[$i]["label"] = $arr["sources"][$i]["label"];
  155.     $jw[$i]["type"] = $arr["sources"][$i]["type"];
  156. }
  157. echo getplayer(json_encode($jw),$image);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement