【问题标题】:How to fetch metadata of a private vimeo video?如何获取私人 vimeo 视频的元数据?
【发布时间】:2017-06-17 06:52:21
【问题描述】:

我正在开发一个需要 vimeo API 的 laravel 项目。

我在 developer.vimeo.com 上生成了客户端和密钥,但似乎无法使用它们。官方 vimeo php 库没有关于它的指南。

我只需要获取私人视频的信息,例如缩略图和时长。

【问题讨论】:

    标签: php laravel-5 vimeo


    【解决方案1】:
    <?php    
       /* You may want to use oEmbed discovery instead of hard-coding the oEmbed endpoint. */
        $oembed_endpoint = 'http://vimeo.com/api/oembed';    
        // Grab the video url from the url, or use default
        $video_url = ($_GET['url']) ? $_GET['url'] : 'http://vimeo.com/7100569';    
        // Create the URLs
        $json_url = $oembed_endpoint . '.json?url=' . rawurlencode($video_url) . '&width=640';
        $xml_url = $oembed_endpoint . '.xml?url=' . rawurlencode($video_url) . '&width=640';
    
        // Curl helper function
        function curl_get($url) {
            $curl = curl_init($url);
            curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($curl, CURLOPT_TIMEOUT, 30);
            curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
            $return = curl_exec($curl);
            curl_close($curl);
            return $return;
        }    
        // Load in the oEmbed XML
        $oembed = simplexml_load_string(curl_get($xml_url));    
    
        /* An alternate approach would be to load JSON,
            then use json_decode() to turn it into an array.*/ 
         ?>
    
    
    
     <!DOCTYPE html>
        <html lang="en">
        <head>
            <meta charset="utf-8">
            <title>Vimeo PHP oEmbed Example</title>
        </head>
        <body>
    
        <h1><?php echo $oembed->title ?></h1>
        <h2>by <a href="<?php echo $oembed->author_url ?>"><?php echo $oembed->author_name ?></a></h2>
    
        <?php echo html_entity_decode($oembed->html) ?>
    
    </body>
    </html>
    

    也试试这个

    https://github.com/vinkla/laravel-vimeo

    【讨论】:

    • 这不是我要求的,我需要知道如何获取私人视频的数据任何可能有用的示例代码。
    猜你喜欢
    • 2015-08-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-01
    • 2015-02-18
    • 1970-01-01
    相关资源
    最近更新 更多