Get users of the latest YouTube videos?

I am looking for a way to get the following from the name or URL of youtube users.

  • sketch
  • link to video on youtube.com
  • Video title

You need to do this using PHP. Is there any youtube api that I can use or something like a simple cake, my best bet?

+6
php youtube
source share
3 answers

Look at the code

<?php error_reporting(E_ALL); $feedURL = 'http://gdata.youtube.com/feeds/api/users/USER-ID/uploads?max-results=50'; $sxml = simplexml_load_file($feedURL); $i=0; foreach ($sxml->entry as $entry) { $media = $entry->children('media', true); $watch = (string)$media->group->player->attributes()->url; $thumbnail = (string)$media->group->thumbnail[0]->attributes()->url; ?> <div class="videoitem"> <div class="videothumb"><a href="<?php echo $watch; ?>" class="watchvideo"><img src="<?php echo $thumbnail;?>" alt="<?php echo $media->group->title; ?>" /></a></div> <div class="videotitle"> <h3><a href="<?php echo $watch; ?>" class="watchvideo"><?php echo $media->group->title; ?></a></h3> <p><?php echo $media->group->description; ?></p> </div> </div> <?php $i++; if($i==3) { echo '<div class="clear small_v_margin"></div>'; $i=0; } } ?> 

The code copied from the post loop SimpleXML works, but breaks halfway through

It will receive users of all YouTube videos. Now it is very easy to develop your own. Learn more about the YouTube API from https://code.google.com/apis/youtube/2.0/reference.html

+17
source share

YouTube has an API available. You can see the link here: https://code.google.com/apis/youtube/2.0/reference.html

+2
source share

All Articles