【问题标题】:How to get stream link from google drive如何从谷歌驱动器获取流链接
【发布时间】:2016-12-25 22:32:24
【问题描述】:

我想从谷歌驱动器获取流链接而不在网络浏览器上播放它。格式链接是这样的。 https://r6---sn-npo7zn7k.c.docs.google.com/videoplayback..

这是驱动链接演示: https://drive.google.com/file/d/0B8_ZB_L8pVIkejU1ai1GNmhKa0k/view

【问题讨论】:

    标签: javascript php google-drive-api


    【解决方案1】:

    您可以使用Drive REST API

    在教程快速入门中,它将解释如何在 JavaScript 中使用 Drive Rest API,以及打开 Drive API、为 OAuth 创建客户端 ID 等基本操作。

    这是您将在快速入门中看到的示例代码部分:

    <html>
    <head>
    <script type="text/javascript">
    // Your Client ID can be retrieved from your project in the Google
    // Developer Console, https://console.developers.google.com
    var CLIENT_ID = '<YOUR_CLIENT_ID>';
    
    var SCOPES = ['https://www.googleapis.com/auth/drive.metadata.readonly'];
    
    /**
    * Check if current user has authorized this application.
    */
    function checkAuth() {
    gapi.auth.authorize(
    {
    'client_id': CLIENT_ID,
    'scope': SCOPES.join(' '),
    'immediate': true
    }, handleAuthResult);
    }
    

    然后你将提取webViewLink的值。

    webViewLink

    • 该链接仅在公共文件夹中可用,用于通过 Google Drive 的网站托管查看其静态网络资产(HTML、CSS、JS 等)。

    这是一个示例response

    {
    "kind": "drive#file",
    "id": string,
    "etag": etag,
    "selfLink": string,
    "webContentLink": string,
    "webViewLink": string,
    "alternateLink": string,
    "embedLink": string,
    "openWithLinks": {
    (key): string
    },
    

    我希望这会有所帮助。

    【讨论】:

      【解决方案2】:

      您可以使用 GetLinkDrive 的 API:

      例如:http://api.getlinkdrive.com/getlink?url=https://drive.google.com/file/d/0B6VYU2mjTdy0WVRjb1BJUU1hYXM/view

      API 会响应如下流链接:

      [{"label":720,"type":"video/mp4","src":"https://redirector.googlevideo.com/videoplayback?requiressl=yes&id=19e3c7fd6fd45f15&itag=22&source=webdrive&ttl=transient&app=api.getlinkdrive.com&ip=139.162.5.123&ipbits=0&expire=1481719234&sparams=requiressl,id,itag,source,ttl,ip,ipbits,expire&signature=97E76D059F08E8B3B3C37FDE840C6B3978ACDD0C.8AF257B52254C7F116E658D6C52A3C5C3244EF75&key=ck2&mm=31&mn=sn-npoe7n7s&ms=au&mt=1481704609&mv=m&nh=IgpwcjA0LnNpbjExKgkxMjcuMC4wLjE&pl=22&safm=0&filename=video.mp4","file":"https://redirector.googlevideo.com/videoplayback?requiressl=yes&id=19e3c7fd6fd45f15&itag=22&source=webdrive&ttl=transient&app=api.getlinkdrive.com&ip=139.162.5.123&ipbits=0&expire=1481719234&sparams=requiressl,id,itag,source,ttl,ip,ipbits,expire&signature=97E76D059F08E8B3B3C37FDE840C6B3978ACDD0C.8AF257B52254C7F116E658D6C52A3C5C3244EF75&key=ck2&mm=31&mn=sn-npoe7n7s&ms=au&mt=1481704609&mv=m&nh=IgpwcjA0LnNpbjExKgkxMjcuMC4wLjE&pl=22&safm=0&filename=video.mp4","res":720}]
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2019-08-18
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多