从Google Drive流式传输视频


Stream Videos From Google Drive

当我将视频上传到Google Drive时,它会转换为许多质量,并可通过youtube播放器进行流媒体播放我的问题是如何使用php获得不同质量的直接视频url。

到目前为止,我尝试了播放器页面file_get_contents,并尝试像下面的一样解析代码

$browser = $_SERVER['HTTP_USER_AGENT'];
$options  = array('http' => array('user_agent' => $browser));
$context  = stream_context_create($options);
$page= file_get_contents($link, false, $context);
$h= explode('"22|',$page);
$h1=$h[1];
$h2=explode(',',$h1);
$hd=$h2[0];
$hdsrc = str_replace(''u003d', '=', $hd);
$hdsrc = str_replace(''u0026', '&', $hdsrc);
$hdsrc = str_replace('%2C', '&', $hdsrc);
$hdsrc = str_replace('''', '', $hdsrc); 

我得到了长网址xxxxxx.谷歌视频…………

但这是不可玩的!!有什么想法吗?我该如何获得不同质量的直接视频URL。

PS:我知道直接下载链接,我想要转换质量的URL。

感谢

链接类型https://drive.google.com/uc?export=download&id={FILE_id}使用REST API v2在android中播放流媒体音频,但在您的google驱动器中,您必须将文件安全更改为"如果您有链接,则为公共"。我希望它能帮助你。