Training At Farata: YouTube Chanel
“.$urlsToReplace[$i].” “, $str);
}
return $str;
} else {
return $str;
}
}
// set feed URLx
$feedURL = “”;
// set feed URL
$feedURL = ‘https://gdata.youtube.com/feeds/api/users/trainingAtFarata/uploads’;
// read feed into SimpleXML object
$sxml = simplexml_load_file($feedURL);
?>
title; */ ?>
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();
// video url on YouTube
$watch = $attrs[‘url’];
// get video thumbnail
$attrs = $media->group->thumbnail[0]->attributes();
$thumbnail = $attrs[‘url’];
// get
$yt = $media->children(‘http://gdata.youtube.com/schemas/2007’);
$attrs = $yt->duration->attributes();
$length = $attrs[‘seconds’];
// get
$yt = $entry->children(‘http://gdata.youtube.com/schemas/2007’);
$attrs = $yt->statistics->attributes();
$viewCount = $attrs[‘viewCount’];
// get
$gd = $entry->children(‘http://schemas.google.com/g/2005’);
if ($gd->rating) {
$attrs = $gd->rating->attributes();
$rating = $attrs[‘average’];
} else {
$rating = 0;
}
$id = $entry->id;
$pos = (strrpos($id, “/”))+1;
//echo substr($id, $pos);
// video ID
$video_id = substr($id, $pos);
*/
?>
entry as $entry) {
$namespaces = $entry->getNameSpaces(true);
$yt = $entry->children($namespaces[‘yt’]);
$videoid = $yt->videoId;
$title = $entry->title;
$media = $entry->children($namespaces[‘media’]);
$description = $media->group->description;
echo(‘
‘.$title.’
‘);
echo(‘
‘.$description.’
‘);
echo(‘
‘);
}
?>