Advertisement
EddieKidiw

Youtube Generate Link Downloader Support Semua Video

Mar 27th, 2016
975
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.91 KB | None | 0 0
  1. <?php
  2.  
  3. /***
  4. Youtube video downloader suport semua video, via http://keepvid.com tanpa api key
  5. Demo 1: http://www.eddiekidiw.xyz/keepvid.com.php?id=pXRviuL6vMY
  6. Demo 2: http://www.eddiekidiw.xyz/keepvid.com.php?id=https://www.youtube.com/watch?v=pXRviuL6vMY&list=PL7C00E83736FB02C3
  7. ***/
  8.  
  9.     // function untuk mengambil teks atau hasil grab yang akan di bagi-bagi
  10.     function a($a,$b,$c){
  11.         $d=explode($b,$a);
  12.         $e=explode($c,$d[1]);
  13.         return $e[0];
  14.     }
  15.  
  16.     // function untuk mengambil kontent dari keepvid.com menggunakan curl, bisa juga pakek file_get_contents()
  17.    
  18.     function b($a){
  19.         $b=curl_init();
  20.         curl_setopt($b,CURLOPT_URL,$a);
  21.         curl_setopt($b,CURLOPT_USERAGENT,'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.108 Safari/537.36');
  22.         curl_setopt($b,CURLOPT_RETURNTRANSFER,true);
  23.         $c=curl_exec($b);
  24.         curl_close($b);
  25.         return $c;
  26.     }
  27.  
  28.     $id=$_GET['id'];
  29.     //cek id atau url youtube dari $id yang di hasilkan dari $_GET['id']
  30.    
  31.     if(empty($id)){
  32.         //stop script jika $id kosong
  33.         echo'id nya mana...?';
  34.     } else {
  35.         //jalankan script jika $id berisi id atau url video
  36.        
  37.         if(strlen($id) == 11){
  38.             //jalankan jika $id hanya berisi id video, ( 11 digit acak ext: pXRviuL6vMY )
  39.             $a='http://www.youtube.com/watch?v='.$id;
  40.         } else {
  41.             //jalankan jika $id berisi url youtube full ( ext: https://www.youtube.com/watch?v=pXRviuL6vMY&list=PL7C00E83736FB02C3 atau https://www.youtube.com/watch?v=pXRviuL6vMY )
  42.             $a=$id;
  43.         }
  44.  
  45.         $b=b('http://keepvid.com/?url='.$a);
  46.         //mengambil kontent dari keepvid.com
  47.         $c=a($b,'<br clear="both" /><br /></div>','<b style="color:#e01b3c;">');
  48.         //potong kontent yang sudah di ambil tadi
  49.         echo $c;
  50.         //Tampilkan hasil url downloadnya
  51.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement