Keledan

Get YouTube subs and stats in Minecraft by Keledan75

Feb 24th, 2013
1,465
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.68 KB | None | 0 0
  1. <?php
  2. $canale = $_GET['channel'];
  3. $funzione = $_GET['funzione'];
  4.  
  5.  
  6. $ciao = json_decode(file_get_contents('http://gdata.youtube.com/feeds/api/users/' . $canale . '?v=2&alt=json'));
  7.  
  8. function getYouTubeVideoViews($channel, $stat = 'totalUploadViews')
  9. {
  10.   return json_decode(file_get_contents('http://gdata.youtube.com/feeds/api/users/' . $channel . '?v=2&alt=json'))->entry->{'yt$statistics'}->$stat;
  11. }
  12.  
  13.  
  14.  
  15. switch ($funzione){
  16.  
  17. case "iscritti":
  18.     echo getYouTubeVideoViews($canale, 'subscriberCount');
  19.     break;
  20.  
  21. case "views":
  22.     echo getYouTubeVideoViews($canale, 'viewCount');
  23.     break;
  24.    
  25. case "video":
  26.     echo getYouTubeVideoViews($canale, 'videoWatchCount');
  27.     break;
  28.    
  29. }
  30.  
  31. ?>
Advertisement
Add Comment
Please, Sign In to add comment