【发布时间】:2014-05-22 08:25:07
【问题描述】:
这是我来自 facebook ID 的 YouTube Tube URL。我在 Zend Framework 的 facebook 中使用 FQL Query 获取了这个 url
这是我的网址 = "http://www.youtube.com/attribution_link?a=AbE6fYtNaa4&u=%2Fwatch%3Fv%3DNbyHNASFi6U%26feature%3Dshare"
现在我需要获取它的 ID,以便我可以将它传递给这个代码,以便我可以生成它的视频详细信息。
function listYoutubeVideo($id) {
$video = array();
try {
$yt = new Zend_Gdata_YouTube();
$videoEntry = $yt->getVideoEntry($id);
$videoEntry = $yt->getQueryUrl($id);
$videoThumbnails = $videoEntry->getVideoThumbnails();
$video = array(
'thumbnail' => $videoThumbnails[0]['url'],
'title' => $videoEntry->getVideoTitle(),
'description' => $videoEntry->getVideoDescription(),
'tags' => implode(', ', $videoEntry->getVideoTags()),
'url' => $videoEntry->getVideoWatchPageUrl(),
'flash' => $videoEntry->getFlashPlayerUrl(),
'dura' => $videoEntry->getVideoDuration(),
'id' => $videoEntry->getVideoId()
);
} catch (Exception $e) {
echo $e->getMessage();
exit();
}
return $video;
}
所以我只需要从 Zend 框架中的 youtube URL 中找到它的 youtube ID。请为我提供解决方案。 "Zend_Gdata_YouTube" 类中是否存在任何方法,我可以通过其 youtube URL 获取其 ID 表单
【问题讨论】:
-
对不起,如果这听起来很愚蠢,但网址中的视频 ID 不是吗?不就是
v参数吗?你可以从网址中提取它吗? -
是的,我知道 youtube ID 存在于 V 参数之后。基本上我是从 facebook 的用户资料中获取这个 youtube url。
标签: php zend-framework