在 YouTube 上
我如何获取我订阅的频道的最新上传视频的 ID(网址如 v=....),用于嵌入
我在我的服务器端使用 php
截至2015年4月20日,上述答案似乎不再有效。以下是使用 YouTube 频道 ID 的示例(可以在频道页面的源代码中找到。)
<?php
$id = NULL;
$channel_id = 'someChannelID';
$xml = simplexml_load_file(sprintf('https://www.youtube.com/feeds/videos.xml?channel_id=%s', $channel_id));
if (!empty($xml->entry[0]->children('yt', true)->videoId[0])){
$id = $xml->entry[0]->children('yt', true)->videoId[0];
}
echo $id; // Outputs the video ID.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)