php - Extract Video URL or ID From a YouTube Playlist Using YouTube API -
i using following php script grab title , description each of youtube videos in playlist, have not been able figure out how grab youtube id or url videos. query need?
<?php $cont = json_decode(file_get_contents('http://gdata.youtube.com/feeds/api/playlists/atwambkrzsrgvsvxlcw74lu7jb31954x/?v=2&alt=json&feature=plcp')); ?> <?php $feed = $cont->feed->entry; ?> <?php if(count($feed)): foreach($feed $item): // youtube start ?> <?php echo $item->title->{'$t'} ?> <br /> <?php echo $item->{'media$group'}->{'media$description'}->{'$t'} ?> <?php endforeach; endif; // youtube end ?>
<?php $cont = json_decode(file_get_contents('http://gdata.youtube.com/feeds/api/playlists/atwambkrzsrgvsvxlcw74lu7jb31954x/?v=2&alt=json&feature=plcp')); ?> <?php $feed = $cont->feed->entry; ?> <?php if(count($feed)): foreach($feed $item): // youtube start ?> <?php echo $item->title->{'$t'} ?> <br /> <?php echo $item->{'media$group'}->{'media$description'}->{'$t'} ?> <?php echo $item->{'media$group'}->{'yt$videoid'}->{'$t'} ?> <?php endforeach; endif; // youtube end ?>
you have had right trace. property need here yt$videoid added here.
Comments
Post a Comment