CodeIgniter将视频从localhost上传到YouTube

时间:2014-12-03 15:23:28

标签: php codeigniter youtube google-api-php-client

我尝试将视频从本地服务器上传到我的YouTube帐户。我一直在尝试从https://github.com/jimdoescode/CodeIgniter-YouTube-API-Library实现此示例,但显然已弃用并返回"消费者密钥未注册"。

我已成功完成身份验证,但我们非常感谢任何支持较新的YouTube v3 API的新库。我正在使用CodeIgniter。

1 个答案:

答案 0 :(得分:0)

您应该遵循youtube创建的官方PHP API:

  1. Official PHP API provided by YouTube (link towards github)
  2. Google APIs Client Library for PHP
  3. Google APIs Client Library for PHP Get Started
  4. 不确定您是如何错过的,因为其中一个链接已放入您提供的链接的弃用部分。

    Here is an example of a fileupload that can be found on the github

    此时的所有信息均直接来自github:

    说明

      

    Google API客户端库可让您使用Google API   例如您服务器上的Google+,云端硬盘或YouTube。

    来自github的基本示例:

      

    有关关键客户端功能的示例,请参阅examples /目录。

    <?php
    
      require_once 'google-api-php-client/autoload.php'; // or wherever autoload.php is located
    
      $client = new Google_Client();
      $client->setApplicationName("Client_Library_Examples");
      $client->setDeveloperKey("YOUR_APP_KEY");
    
      $service = new Google_Service_Books($client);
      $optParams = array('filter' => 'free-ebooks');
      $results = $service->volumes->listVolumes('Henry David Thoreau', $optParams);
    
      foreach ($results as $item) {
        echo $item['volumeInfo']['title'], "<br /> \n";
      }
    

    来自Google图书馆页面的消息:

      

    此客户端库处于测试阶段。我们将努力支持   库,并在未来保持向后兼容性,但我们   保留在必要时进行不兼容更改的权利。