【问题标题】:How to get video commented users profile Details using Zend Gdata YouTube?如何使用 Zend Gdata YouTube 获取视频评论用户个人资料详细信息?
【发布时间】:2015-03-09 06:18:58
【问题描述】:

我正在尝试在 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(),
);

【问题讨论】:

  • 请让您的问题更清楚。

标签: php zend-framework youtube


【解决方案1】:

从这里找,

        $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');
                    }
                }
            }
        }

【讨论】:

    猜你喜欢
    • 2014-04-20
    • 2011-01-13
    • 1970-01-01
    • 2016-09-02
    • 2016-04-10
    • 2016-10-13
    • 2017-10-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多