jhylands

No adds playlist

Jun 18th, 2012
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.80 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title>Youtube uninterupted playlists</title>
  4. <?php
  5. function GetHTML($page){
  6. //start cURL
  7.     $handle = curl_init();
  8.     curl_setopt_array(
  9.         $handle,
  10.         array(
  11.             CURLOPT_URL => $page,
  12.             CURLOPT_RETURNTRANSFER => true
  13.         )
  14.     );
  15.     $response = curl_exec($handle);
  16.     curl_close($handle);
  17.     return $response;
  18. //This marks then end of the cURL
  19. }
  20. ?>
  21. </head>
  22. <body onload="myFunction()">
  23. <script type="text/javascript">
  24. <?php
  25. //Start of the clipping
  26.     $needle1 = '<li class="playlist-video-item' ;
  27.     $ListPage =  GetHTML("http://www.youtube.com/playlist?list=UUSXm6c-n6lsjtyjvdD0bFVw");
  28.     $i = 0;
  29.     if ($ListPage == "") echo "<h1>ERROR Page was not found</h1>";
  30.     do{
  31.         //get the video URL
  32.         $ListPage = substr($ListPage, strpos($ListPage,$needle1)+30) ;
  33.         $URL = substr($ListPage ,1, strpos($ListPage,"</span"));
  34.         $URL = substr($URL, strpos($URL,'<a href="') + 9);
  35.         $URL = substr($URL,1,strpos($URL, '"')-1);
  36.         $URL = "http://www.youtube.com/" . $URL;
  37.         $AURL[] = $URL;
  38.         //get the video length
  39.         $time = GetHTML($URL);
  40.         $time = substr($time , strpos($time , "length_seconds=")+14);
  41.         $time = substr($time, 1,strpos($time,"\\")-1);
  42.         $ATime[] = $time;
  43.         $i++;
  44.     } while($i <= 10);
  45. //End of clipping at this point all of the information has been gathered
  46. //Write HTML code
  47.     $JavaURL = "var AURL = [";
  48.     for ($i=0; $i<10; $i++){
  49.         $JavaURL = $JavaURL . '"' . $AURL[$i] . '",';
  50.     }
  51.     $JavaURL = $JavaURL . "];";
  52.     $JavaTime = "var ATime = [";
  53.     for($i=0; $i<10; $i++){
  54.         $JavaTime = $JavaTime . '"' . $ATime[$i] . '",';
  55.     }
  56.     $JavaTime = $JavaTime . "];";
  57.     echo $JavaTime;
  58.     echo $JavaURL;
  59. ?>
  60. var i;
  61. function myFunction()
  62. {
  63. i = 0;
  64. play();
  65. }
  66. function play(){
  67. document.getElementById("bob").setAttribute("src",AURL[i]);
  68. i++;
  69. setTimeout("play()",ATime[i] * 1000);
  70. }
  71. </script>
  72. <iframe id="bob" src="http://www.facebook.com" width = "100%"> </iframe>
  73. </body>
  74. </html>
Advertisement
Add Comment
Please, Sign In to add comment