Youtube API get video duration from the XML
问题 Consider Youtube API XML files like http://gdata.youtube.com/feeds/api/videos/$id One particular XML data file is http://gdata.youtube.com/feeds/api/videos/GI6CfKcMhjY The following function gets the title of the video according to the XML url: function ytTitle($ytid,$ytURLConstant){ $url = $ytURLConstant.$ytid; $doc = new DOMDocument; $doc->load($url); echo $title = $doc->getElementsByTagName("title")->item(0)->nodeValue; } As I see there is video duration in the XML file: <media:title type=