Reputation: 131
How can I read XML from YouTube? I tried the following.
$xml = new XMLReader();
$xml->open('http://gdata.youtube.com/feeds/api/videos/1uwOL4rB-go');
$r = array();
while($xml->read()) {
$r[] = array($xml->name => $xml->value);
}
I got this far but it doesnt get the necesary info I need like video duration.
Upvotes: 3
Views: 6921
Reputation: 1906
This was already seen in multiple flavors, SimpleXML and DOMDocument: SimpleXML returning multiple objects, how can I get the data?
Upvotes: 0
Reputation: 37643
The duration is stored in the yt:duration
node, under the media:group
aggregate.
What language are you using? There are client libraries created by Google for Java, .NET, Python, PHP, and Objective-C. There is also WebService::YouTube on CPAN if you are using Perl.
Upvotes: 1