Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Pessoal,
Estou usando este script abaixo para listar, em thumbnails, os vídeos de um canal no Youtube:
<?php
// set feed URL
$feedURL = 'http://gdata.youtube.com/feeds/api/users/tvcultura/uploads';
// read feed into SimpleXML object
$sxml = simplexml_load_file($feedURL);
// iterate over entries in feed
foreach ($sxml->entry as $entry) {
// get nodes in media: namespace for media information
$media = $entry->children('http://search.yahoo.com/mrss/');
// get video player URL
$attrs = $media->group->player->attributes();
$watch = $attrs['url'];
// get video thumbnail
$attrs = $media->group->thumbnail[0]->attributes();
$thumbnail = $attrs['url'];
?>
<a href="<?php echo $watch; ?>" target="_blank"><img src="<?php echo $thumbnail;?>" border="0" width="200" /></a><br><br>
<?php
}
?>
Alguém pode me dar uma ajuda em limitar a apresentação com apenas o 3 primeiros thumbnails?
Muito obrigado,
Carregando comentários...