我想從谷歌驅動器獲取流鏈接,而無需在網絡瀏覽器上播放它。格式鏈接像這樣。 https://r6---sn-npo7zn7k.c.docs.google.com/videoplayback ..如何從谷歌驅動器獲取流鏈接
這裏是驅動器鏈接演示: https://drive.google.com/file/d/0B8_ZB_L8pVIkejU1ai1GNmhKa0k/view
我想從谷歌驅動器獲取流鏈接,而無需在網絡瀏覽器上播放它。格式鏈接像這樣。 https://r6---sn-npo7zn7k.c.docs.google.com/videoplayback ..如何從谷歌驅動器獲取流鏈接
這裏是驅動器鏈接演示: https://drive.google.com/file/d/0B8_ZB_L8pVIkejU1ai1GNmhKa0k/view
您可以使用Drive REST API。
在本教程的快速入門,將解釋如何使用驅動器REST API中的JavaScript和必要的事情要做像開啓該驅動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
- 爲通過谷歌驅動的網站主持查看其靜態Web資源(HTML,CSS,JS等)只能在公共文件夾提供的鏈接。
這裏是一個示例response:
{
"kind": "drive#file",
"id": string,
"etag": etag,
"selfLink": string,
"webContentLink": string,
"webViewLink": string,
"alternateLink": string,
"embedLink": string,
"openWithLinks": {
(key): string
},
我希望這有助於。
您可以使用API從GetLinkDrive:
例: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}]