youplay.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. $config = parse_ini_file('../config/config.ini',true);
  3. if(!isset($_COOKIE["session"]) || $_COOKIE["session"] != "true" || !$config["Media"]["youplay"]) {
  4. http_response_code(403);
  5. die('Forbidden');
  6. }
  7. ?>
  8. <!DOCTYPE html>
  9. <html lang="en" style="height:100%">
  10. <head>
  11. <meta charset="utf-8">
  12. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  13. <script src="/assets/js/player/youplay.js"></script>
  14. </head>
  15. <body style="margin:0;height:100%;overflow:hidden">
  16. <?php
  17. include("ytclass.php");
  18. $ytclass = new YTDownloader();
  19. $vdata = $ytclass->getDownloadLinks(htmlspecialchars($_GET["id"]));
  20. if($vdata) {
  21. $vlink = $vdata["dl"];
  22. ?>
  23. <video class="video-js vjs-default-skin" controls id="player" poster="<?=$vdata["info"]["Thumbnail"]?>" title="<?=$vdata["info"]["Title"]?>" style="width:100%;height:100%">
  24. Your browser does not support the video tag.
  25. </video>
  26. <script>
  27. yp_player({share:false,use_desktop_skin:true,sources:[
  28. <?php
  29. $formats = array();
  30. for($i=0;$i<count($vlink);$i++) {
  31. if(!strstr($vlink[$i]["type"]," Only)")) {
  32. array_push($formats,$vlink[$i]["type"]);
  33. echo "{src:'".$vlink[$i]["url"]."',label:'".$vlink[$i]["type"]."',audio:true},";
  34. }
  35. else if(strstr($vlink[$i]["type"],"(Video Only)") && !in_array(substr($vlink[$i]["type"],13),$formats)) echo "{src:'".$vlink[$i]["url"]."',label:'".substr($vlink[$i]["type"],13)."',audio:false},";
  36. }
  37. ?>
  38. ],audio_url:[
  39. <?php
  40. for($i=0;$i<count($vlink);$i++) {
  41. if(strstr($vlink[$i]["type"],"(Audio Only)")) echo "'".$vlink[$i]["url"]."',";
  42. }
  43. ?>
  44. ]});
  45. </script>
  46. <?php } else { ?>
  47. Sorry, there was an error while trying to load your video.
  48. <?php } ?>
  49. </body>
  50. </html>