Reading XML from YouTube Video

How to 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 he does not get the necessary information that I need, like the duration of the video.

+3
source share
2 answers

Duration is stored in yt:durationnode, under the aggregate media:group.

What language do you use? There are client libraries created by Google for Java, .NET, Python, PHP, and Objective-C. There is also WebService :: YouTube in CPAN if you use Perl.

+1
source

Source: https://habr.com/ru/post/1731703/


All Articles