Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting videos from a user's playlist -YouTube API

Tags:

youtube-api

Is there a way to get a listing of videos from a specific user's playlist? I tried the following call, but it doesn't seem to be giving me a list of videos in that playlist

feed://gdata.youtube.com/feeds/users/USERNAME/playlists/PLAYLIST_ID

Thanks in advance,

Scott

like image 284
Scott Avatar asked Jan 05 '11 18:01

Scott


1 Answers

http://gdata.youtube.com/feeds/api/playlists/PLAYLIST_ID

Update

Just to add to this answer The url above... works however as @crunkchitis mentioned below.

This wouldn't work for me because I was using the wrong playlist ID. My playlists looked like "PL123456789" but make sure just to ditch the "PL" and use "123456789" as your playlist ID!! – @crunkchitis

If you need a way to extract this info... using PHP...

<?php $cont = json_decode(file_get_contents('http://gdata.youtube.com/feeds/api/playlists/[PLAYLIST_ID]/?v=2&alt=json&feature=plcp')); ?>
<?php $feed = $cont->feed->entry; ?>
<?php if(count($feed)): foreach($feed as $item): // youtube start ?>
   <?php echo $item->title->{'$t'}  ?> <br />
   <?php echo $item->{'media$group'}->{'media$description'}->{'$t'}  ?>
<?php endforeach; endif; // youtube end ?>

user print_r($item) should you need other information such as thumbnail url, id etc...

Hope it helps

like image 192
Tipperds Avatar answered Sep 21 '22 17:09

Tipperds