【问题标题】:What does the insertEntry in YOUTUBE API return?YOUTUBE API 中的 insertEntry 会返回什么?
【发布时间】:2011-02-18 07:02:14
【问题描述】:

这是我们使用 YouTube API 将视频上传到 YouTube 的方法。

$newEntry = $yt->insertEntry($myVideoEntry, $uploadUrl, 'Zend_Gdata_YouTube_VideoEntry');

上传后,如何获取刚刚上传的视频的唯一码?? 我的意思是,在网址中, http://www.youtube.com/watch?v=pBI3lc18k8Q

“pBI3lc18k8Q”是视频的唯一代码。那么,我们刚刚上传的视频如何获取呢?

【问题讨论】:

    标签: php youtube youtube-api


    【解决方案1】:

    上传后执行此代码:

    // Assuming that $videoEntry is the object that was returned during the upload
    $state = $videoEntry->getVideoState();
    
    if ($state) {
      echo 'Upload status for video ID ' . $videoEntry->getVideoId() . ' is ' .
        $state->getName() . ' - ' . $state->getText() . "\n";
      } else {
        echo "Not able to retrieve the video status information yet. " . 
          "Please try again later.\n";
    }
    

    【讨论】:

    • 非常感谢,$newVideoURL = "http://www.youtube.com/watch?v=".$videoEntry->getVideoId();
    【解决方案2】:

    您在 $newEntry 中获得了您的唯一代码! ;)

    【讨论】:

      猜你喜欢
      • 2013-04-11
      • 2020-09-26
      • 2013-02-02
      • 1970-01-01
      • 2021-04-13
      • 2019-09-20
      • 2011-10-05
      • 1970-01-01
      • 2012-04-07
      相关资源
      最近更新 更多