gpt4 book ai didi

php - 从 YouTube 视频中读取 XML

转载 作者:数据小太阳 更新时间:2023-10-29 02:43:15 24 4
gpt4 key购买 nike

如何从 YouTube 读取 XML?我尝试了以下方法。

 $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);
}

我已经走到这一步了,但它没有获得我需要的必要信息,例如视频时长。

最佳答案

持续时间存储在 yt:duration 节点中,位于 media:group 聚合下。

您使用的是什么语言? Google 为 Java、.NET、Python、PHP 和 Objective-C 创建了客户端库。还有WebService::YouTube on CPAN如果您使用的是 Perl。

关于php - 从 YouTube 视频中读取 XML,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2214734/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com