I'm trying to develop a site with some youtube videos. After I retrieve the XML file from their API, I have the following.
<?xml version='1.0' encoding='UTF-8'?>
<entry xmlns='http://www.w3.org/2005/Atom' xmlns:media='http://search.yahoo.com/mrss/' xmlns:gd='http://schemas.google.com/g/2005' xmlns:yt='http://gdata.youtube.com/schemas/2007'>
<id>http://gdata.youtube.com/feeds/api/videos/4ZsiqqOyWx8</id>
<published>2007-08-03T05:48:51.000Z</published>
[...]
<author>
<name>ak326</name>
<uri>http://gdata.youtube.com/feeds/api/users/ak326</uri>
</author>
<gd:comments>
<gd:feedLink href='http://gdata.youtube.com/feeds/api/videos/4ZsiqqOyWx8/comments' countHint='0'/>
</gd:comments>
<media:group>
[...]
<yt:duration seconds='222'/>
</media:group>
<gd:rating average='5.0' max='5' min='1' numRaters='4' rel='http://schemas.google.com/g/2005#overall'/>
<yt:statistics favoriteCount='8' viewCount='2674'/>
</entry>
I'm trying to retrieve the length of this video from with PHP but with
echo $xml->media->yt
But it's not working. I think it has something to do with the psuedo class on media and yt but I don't know how to select those.