简体   繁体   English

在 JW Player 中播放 Google Drive Video 并获取 Google Drive Video 的直接链接

[英]Play Google Drive Video in JW Player And Get Direct Link For Google Drive Video

I want to PLay google drive videos in JW player in my website .I know it is possible because a lot of websites doing this eg fmovies我想在我的网站的 JW 播放器中播放谷歌驱动器视频。我知道这是可能的,因为很多网站都这样做,例如fmovies

Is there any API or piece of code through which i can achieve this URL for google drive video https://redirector.googlevideo.com/videoplayback?id=4d0be5bc491e2dd7&itag=18&source=webdrive&requiressl=yes&ttl=transient&pl=21&mime=video/mp4&ipbits=0&sparams=api,expire,id,ip,ipbits,itag,mime,mm,mn,ms,mv,pl,requiressl,source,ttl&api=FsxSHTiLgbCln6EzpdilVgW6JQxNqam8I5YPHEFLs3E=&cms_redirect=yes&expire=1499015322&ip=37.187.148.42&mm=30&mn=sn-25ge7ney&ms=nxu&mt=1499000741&mv=m&signature=658276E5F00AAFD155876EC75453507DE10DDEDB.7FAD65986F21E14B5FAFB6E145252310F86A10B6&key=cms1&app=storage是否有任何 API 或一段代码可以让我获得谷歌驱动器视频的 URL https://redirector.googlevideo.com/videoplayback?id=4d0be5bc491e2dd7&itag=18&source=webdrive&requiressl=yes&ttl=transient&pl=21&mime=video/mp4&ipbits=0&s =api,expire,id,ip,ipbits,itag,mime,mm,mn,ms,mv,pl,requiressl,source,ttl&api=FsxSHTiLgbCln6EzpdilVgW6JQxNqam8I5YPHEFLs3E=&cms_redirect=yes&expire=yes&expire=yes&expire=yes&expire=yes&expire=yes&expire=3&7n&7m&7m=1&7n&7m=1 nxu&mt=1499000741&mv=m&signature=658276E5F00AAFD155876EC75453507DE10DDEDB.7FAD65986F21E14B5FAFB6E145252310F86A10Bcm6&key=s10Bcm

I already tried juicy API but its not working for me我已经尝试过 juicy API 但它对我不起作用

If you just want to stream a video from Google drive then this can be done - you can see a working example here:如果您只想从 Google Drive 流式传输视频,那么可以这样做 - 您可以在这里看到一个工作示例:

You can see exactly how it is coded by right clicking and inspecting in your browser您可以通过右键单击并在浏览器中检查来准确了解它的编码方式

<video controls="controls" style="margin-bottom:20px;width:590px">    
         <source src="https://drive.google.com/uc?export=download&amp;id=0B0JMGMGgxp9WMEdWb1hyQUhlOWs" type="video/mp4"> 
</video>

To create a signed URL for Google cloud storage programatically you need to follow their instructions at the link below - I have not copied or summarised them here as, if the similar AWS mechanism is anything to go by, the approach can change often and it is best to always check the latest official documentation:要以编程方式为 Google 云存储创建签名 URL,您需要按照以下链接中的说明进行操作 - 我没有在此处复制或总结它们,因为如果类似的 AWS 机制可以使用,则该方法可以经常更改,并且是最好始终查看最新的官方文档:

You can try this Perl script to get the direct download link.你可以试试这个 Perl 脚本来获取直接下载链接。 If you want to play it in JWPlayer, you'll have to run the script from the server to get the link, then insert that link into the HTML.如果您想在 JWPlayer 中播放它,您必须从服务器运行脚本以获取链接,然后将该链接插入到 HTML 中。

https://circulosmeos.wordpress.com/2014/04/12/google-drive-direct-download-of-big-files/ https://circulosmeos.wordpress.com/2014/04/12/google-drive-direct-download-of-big-files/

Files hosted at Google Drive service can be shared publicly.托管在 Google Drive 服务中的文件可以公开共享。 Nevertheless, if they're too big, Google pages advice that “Google Drive can't scan this file for viruses” and ask the user for confirmation in order to proceed with the download.然而,如果它们太大,Google 页面会建议“Google Drive 无法扫描此文件中的病毒”并要求用户确认以继续下载。

If for any reason you're trying to do an unattended download of the file or downloading it on a resource-limited environment, this will prevent direct use of the link.如果您出于某种原因尝试无人值守下载文件或在资源有限的环境中下载文件,这将阻止直接使用该链接。

Here is the script这是脚本

https://github.com/circulosmeos/gdown.pl https://github.com/circulosmeos/gdown.pl

However, the script downloads the file to the filesystem, so you'll have to modify it so on the last URL re-direct, you save the final URL instead of downloading it.但是,脚本会将文件下载到文件系统,因此您必须修改它,以便在最后一个 URL 重定向时保存最终 URL,而不是下载它。

if you have WordPress Webiste you can use GD Player WordPress Plugin works with Google Drive Mp4 etc.. it can also set subtitles in videos.如果您有 WordPress Webiste,您可以使用GD Player WordPress Plugin 与 Google Drive Mp4 等配合使用。它还可以在视频中设置字幕。 I use it, and it for me works very well.我使用它,它对我来说效果很好。 I hope this helps.我希望这有帮助。

I was trying to do this, I'm able to get the URL, but then there's the problem of streaming it from the server back to the client, basically use puppeteer to go to the URL, click the play button, wait for the video eleemnt to appear, get the "src" attribute, then (somehow over XMLHttpRequest) stream it back to the server, then have the server (nodeJS) stream it back to the client, then use that URL to embed the video (not complete yet see my [very humble] question on it for more):我正在尝试这样做,我能够获取 URL,但是将其从服务器流式传输回客户端存在问题,基本上使用 puppeteer 转到 URL,单击播放按钮,等待视频eleemnt 出现,获取“src”属性,然后(以某种方式通过 XMLHttpRequest)将其流回服务器,然后让服务器(nodeJS)将其流回客户端,然后使用该 URL 嵌入视频(尚未完成)有关更多信息,请参阅我的 [非常谦虚] 问题):

var puppeteer = require("puppeteer-core");
var http=require("https");
var fs=require("fs");
var fetch=require("fetch-node");
(async() => {
    var browser = await puppeteer.launch({
        executablePath:"./cobchrome/chrome.exe"
    });
    console.log("Got browser", browser);
    var page = await browser.newPage();

    console.log(page,"got page");

    await page.goto("https://docs.google.com/file/d/0B9aMNh1shw_4VUVVWkF0TjRHWTA/preview?enablejsapi=1&playerapiid=player4");
    console.log("went to page..");


    var newClickID = ".ndfHFb-c4YZDc";
    var clicker = await page.waitForSelector(newClickID);

    await page.click(newClickID);

    var frame = await page.waitForSelector("iframe[id=drive-viewer-video-player-object-0]");




    var cf = await frame.contentFrame();

    await cf.waitFor(() => !!document.querySelector("video"))

    var video = await cf.$("video");

    var videoEl = await cf.evaluate(
        v =>{
            var result = {};
            for(var k in v) {
                result[k] = v[k];
            }
            return result;
        },
        video
    );
    var src = videoEl.src;


    await page.goto(src);
    console.log("went to video page ", src);
    var file = fs.createWriteStream("output/therebbe.mp4");
        var count = 0;

    page.on("console", c => {
        var txt = (c.text()),
            buff = Buffer.from(txt,"base64");
     //   var pic = fs.createWriteStream("output/frame"+count+".png");
       // pic.write(buff);
      //  pic.end();
        console.log("Consoling ",count++, buff);
    //    file.write(buff);
    });

    await page.evaluate(() => {
        function _arrayBufferToBase64( buffer ) {
            var binary = '';
            var bytes = new Uint8Array( buffer );
            var len = bytes.byteLength;
            for (var i = 0; i < len; i++) {
                binary += String.fromCharCode( bytes[ i ] );
            }
            return window.btoa( binary );
        }
        function str2ab(str) {
            var buf = new ArrayBuffer(str.length*2); // 2 bytes for each char
            var bufView = new Uint16Array(buf);
            for (var i=0, strLen=str.length; i < strLen; i++) {
                bufView[i] = str.charCodeAt(i);
            }
            return buf;
        }

        var x = new XMLHttpRequest();
        var url = location.href;
        x.onreadystatechange = function(){
            if(x.readyState == 200) {
                console.log("done");
            } else {
                console.log(
                    _arrayBufferToBase64(
                        str2ab(x.response)
                    )
                );
            }
        }
      //  x.responseType="arraybuffer";
        x.open("GET",url,true);
        x.send("");
    });








 // await browser.close();
})();

I want to PLay google drive videos in JW player in my website .I know it is possible because a lot of websites doing this eg fmovies我想在网站上的JW播放器中播放谷歌驱动视频。我知道这是可能的,因为很多网站都在这样做,例如fmovies

Is there any API or piece of code through which i can achieve this URL for google drive video https://redirector.googlevideo.com/videoplayback?id=4d0be5bc491e2dd7&itag=18&source=webdrive&requiressl=yes&ttl=transient&pl=21&mime=video/mp4&ipbits=0&sparams=api,expire,id,ip,ipbits,itag,mime,mm,mn,ms,mv,pl,requiressl,source,ttl&api=FsxSHTiLgbCln6EzpdilVgW6JQxNqam8I5YPHEFLs3E=&cms_redirect=yes&expire=1499015322&ip=37.187.148.42&mm=30&mn=sn-25ge7ney&ms=nxu&mt=1499000741&mv=m&signature=658276E5F00AAFD155876EC75453507DE10DDEDB.7FAD65986F21E14B5FAFB6E145252310F86A10B6&key=cms1&app=storage我是否可以通过任何API或代码段来获取Google云端硬盘视频的此URL,网址为https://redirector.googlevideo.com/videoplayback?id=4d0be5bc491e2dd7&itag=18&source=webdrive&requiressl=yes&ttl=transient&pl=21&mime=video/mp4&ipbits=0&sparams = api,expire,id,ip,ipbits,itag,mime,mm,mn,ms,mv,pl,requiressl,source,ttl&api = FsxSHTiLgbCln6EzpdilVgW6JQxNqam8I5YPHEFLs3E =&cms_redirect = yes&expire = 1499015322。 nxu&mt = 1499000741&mv = m&signature = 658276E5F00AAFD155876EC75453507DE10DDEDB.7FAD65986F21E14B5FAFB6E145252310F86A10B6&key = cms1&app = storage

I already tried juicy API but its not working for me我已经尝试过多汁的API,但对我不起作用

Just an idea: You don't need JW player or PHP, I's all baked into browsers (HTML5) these days.只是一个想法:你不需要 JW 播放器或 PHP,这些天我都融入了浏览器 (HTML5)。 Here's an example of how to do it (with Google's Material Design UI).这是一个如何做到的示例(使用 Google 的 Material Design UI)。 Just plain old HTML/CSS/JS.只是普通的旧 HTML/CSS/JS。

https://github.com/rhroyston/mdl-audio https://github.com/rhroyston/mdl-audio

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM