我有一个YT视频ID,例如:7-7knsP2n5w
(https://www.youtube.com/watch?v=7-7knsP2n5w)
我需要获取其频道名称(在这种情况下: shakiraVEVO
)和频道ID( UCGnjeahCJW1AF34HBmQTJ-Q
)
有可能吗?
答案 0 :(得分:0)
用PHP解决:
$videoid = "7-7knsP2n5w";
$xml_video = simplexml_load_file("http://gdata.youtube.com/feeds/api/videos/".$videoid);
$xml_channel = simplexml_load_file($xml_video->author->uri);
//author:
echo $xml_video->author->name;
//channel:
echo $xml_channel->link[0]["href"];