如何使用 Zend Gdata YouTube 获取视频评论的用户个人资料详细信息?
How to get video commented users profile Details using Zend Gdata YouTube?
我正在尝试获取 youtube 中视频的详细信息。除了在视频中发表评论的用户的照片外,我能够获得详细信息。如何在没有在 youtube 上进行身份验证的情况下获取评论视频的用户的照片。
这是我的代码
$yt = new Zend_Gdata_YouTube();
$videoEntry = $yt->getVideoEntry($video_id);
$videoThumbnails = $videoEntry->getVideoThumbnails();
$videoDet = 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(),
'Author' => $videoEntry->getAuthor(),
'Content' => $videoEntry->getContent(),
'Published' => $videoEntry->getPublished(),
'Rating' => $videoEntry->getRating(),
'Summary' => $videoEntry->getSummary(),
'Duration' => $videoEntry->getVideoDuration(),
'Comments' => $videoEntry->getComments(),
'Viewer' => $videoEntry->getVideoViewCount(),
);
从这里找到,
$yt = new Zend_Gdata_YouTube();
$commentFeed = $yt->getVideoCommentFeed($video_id);
foreach ($commentFeed as $commentEntry)
{
$feedURL = $commentEntry->author[0]->uri->text;
$xmlReader = new XMLReader();
$xmlReader->open(feedURL);
while($xmlReader->read())
{
// check to ensure nodeType is an Element not attribute or #Text
$thumbnail=$xmlReader->getAttributeNs('thumbnail','media');
if($xmlReader->nodeType == XMLReader::ELEMENT)
{
if($xmlReader->localName == 'thumbnail')
{
$photoUrl = $xmlReader->getAttribute('url');
}
}
}
}
我正在尝试获取 youtube 中视频的详细信息。除了在视频中发表评论的用户的照片外,我能够获得详细信息。如何在没有在 youtube 上进行身份验证的情况下获取评论视频的用户的照片。
这是我的代码
$yt = new Zend_Gdata_YouTube();
$videoEntry = $yt->getVideoEntry($video_id);
$videoThumbnails = $videoEntry->getVideoThumbnails();
$videoDet = 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(),
'Author' => $videoEntry->getAuthor(),
'Content' => $videoEntry->getContent(),
'Published' => $videoEntry->getPublished(),
'Rating' => $videoEntry->getRating(),
'Summary' => $videoEntry->getSummary(),
'Duration' => $videoEntry->getVideoDuration(),
'Comments' => $videoEntry->getComments(),
'Viewer' => $videoEntry->getVideoViewCount(),
);
从这里找到,
$yt = new Zend_Gdata_YouTube();
$commentFeed = $yt->getVideoCommentFeed($video_id);
foreach ($commentFeed as $commentEntry)
{
$feedURL = $commentEntry->author[0]->uri->text;
$xmlReader = new XMLReader();
$xmlReader->open(feedURL);
while($xmlReader->read())
{
// check to ensure nodeType is an Element not attribute or #Text
$thumbnail=$xmlReader->getAttributeNs('thumbnail','media');
if($xmlReader->nodeType == XMLReader::ELEMENT)
{
if($xmlReader->localName == 'thumbnail')
{
$photoUrl = $xmlReader->getAttribute('url');
}
}
}
}