Hi
I'm trying to get the video data from this youtube playlist feed and add the interesting data to an array and use that later, but as you can see from the feed some videolinks are "dead" and that results in problems for my code.
The error I get is "Node no longer exists" when I try to access $attrs['url']. I've tried for hours to find a way to check if the node exists before I access it but I have no luck.
If anyone could help me to either parse the feed some other way with the same result or create a if-node-exists check that works I would be most happy. Thank you in advance
$url = 'http://gdata.youtube.com/feeds/api/playlists/18A7E36C33EF4B5D?v=2';
$sxml = simplexml_load_file($url);
$i = 0;
$videoobj;
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();
$videoobj[$i]['url'] = $attrs['url'];
// get video thumbnail
$attrs = $media->group->thumbnail[0]->attributes();
$videoobj[$i]['thumb'] = $attrs['url'];
$videoobj[$i]['title'] = $media->group->title;
$i++;
}