1
考慮的Youtube API的XML文件,如http://gdata.youtube.com/feeds/api/videos/ $ id來獲取視頻時長 一個特定的XML數據文件是http://gdata.youtube.com/feeds/api/videos/GI6CfKcMhjY 下面的函數根據XML URL獲取視頻的標題:的Youtube API從XML
function ytTitle($ytid,$ytURLConstant){
$url = $ytURLConstant.$ytid;
$doc = new DOMDocument;
$doc->load($url);
echo $title = $doc->getElementsByTagName("title")->item(0)->nodeValue;
}
當我看到有在XML文件中的視頻時長:
<media:title type='plain'>Jack Sparrow (feat. Michael Bolton)</media:title><yt:duration seconds='197'/>
我作爲一個XML新手關於獲取視頻持續時間任何幫助將不勝感激。