MOBILE YOUTUBE
registerXPathNamespace('atom', 'http://www.w3.org/2005/Atom'); $categories = $cxml->xpath('//atom:category'); // iterate over category list foreach ($categories as $c) { if(($c['term']=="Autos") || ($c['term']=="Comedy") || ($c['term']=="Entertainment") || ($c['term']=="Sports") || ($c['term']=="News")) { // for each category // set feed URL $feedURL = "http://gdata.youtube.com/feeds/mobile/videos/-/{$c['term']}?max-results=1&orderby=viewCount&format=1"; // read feed into SimpleXML object $sxml = simplexml_load_file($feedURL); // get summary counts from opensearch: namespace $counts = $sxml->children('http://a9.com/-/spec/opensearchrss/1.0/'); $total = $counts->totalResults; ?> 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 3GP STREAM URL 2 $attrs = $media->group->content[0]->attributes(); $mobilestream = $attrs['url']; // get video thumbnail $attrs = $media->group->thumbnail[0]->attributes(); $thumbnail = $attrs['url']; // get node for video length $yt = $media->children('http://gdata.youtube.com/schemas/2007'); $attrs = $yt->duration->attributes(); $length = $attrs['seconds']; // get node for video ratings $gd = $entry->children('http://schemas.google.com/g/2005'); if ($gd->rating) { $attrs = $gd->rating->attributes(); $rating = $attrs['average']; } else { $rating = 0; } // get video ID $arr = explode('/',$entry->id); $id = $arr[count($arr)-1]; ?> "; } }} include("footer3.php"); ?>
XtGem Forum catalog