Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Youtube uninterupted playlists</title>
- <?php
- function GetHTML($page){
- //start cURL
- $handle = curl_init();
- curl_setopt_array(
- $handle,
- array(
- CURLOPT_URL => $page,
- CURLOPT_RETURNTRANSFER => true
- )
- );
- $response = curl_exec($handle);
- curl_close($handle);
- return $response;
- //This marks then end of the cURL
- }
- ?>
- </head>
- <body onload="myFunction()">
- <script type="text/javascript">
- <?php
- //Start of the clipping
- $needle1 = '<li class="playlist-video-item' ;
- $ListPage = GetHTML("http://www.youtube.com/playlist?list=UUSXm6c-n6lsjtyjvdD0bFVw");
- $i = 0;
- if ($ListPage == "") echo "<h1>ERROR Page was not found</h1>";
- do{
- //get the video URL
- $ListPage = substr($ListPage, strpos($ListPage,$needle1)+30) ;
- $URL = substr($ListPage ,1, strpos($ListPage,"</span"));
- $URL = substr($URL, strpos($URL,'<a href="') + 9);
- $URL = substr($URL,1,strpos($URL, '"')-1);
- $URL = "http://www.youtube.com/" . $URL;
- $AURL[] = $URL;
- //get the video length
- $time = GetHTML($URL);
- $time = substr($time , strpos($time , "length_seconds=")+14);
- $time = substr($time, 1,strpos($time,"\\")-1);
- $ATime[] = $time;
- $i++;
- } while($i <= 10);
- //End of clipping at this point all of the information has been gathered
- //Write HTML code
- $JavaURL = "var AURL = [";
- for ($i=0; $i<10; $i++){
- $JavaURL = $JavaURL . '"' . $AURL[$i] . '",';
- }
- $JavaURL = $JavaURL . "];";
- $JavaTime = "var ATime = [";
- for($i=0; $i<10; $i++){
- $JavaTime = $JavaTime . '"' . $ATime[$i] . '",';
- }
- $JavaTime = $JavaTime . "];";
- echo $JavaTime;
- echo $JavaURL;
- ?>
- var i;
- function myFunction()
- {
- i = 0;
- play();
- }
- function play(){
- document.getElementById("bob").setAttribute("src",AURL[i]);
- i++;
- setTimeout("play()",ATime[i] * 1000);
- }
- </script>
- <iframe id="bob" src="http://www.facebook.com" width = "100%"> </iframe>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment