我有一个谷歌驱动器视频文件(如https://drive.google.com/file/d/FILE_ID/view),我想获得它的redirector.googlevideo.com链接.
像http://api.getlinkdrive.com/这样的网站如何做到这一点?我尝试过使用Google Drive REST API(v2和v3),但仍无法找到方法.许多电视节目和电影网站在谷歌驱动器上托管他们的内容,并使用这个“隐形”的URL到期,所以你不能把它嵌入其他地方.
我最接近的是访问docs.google.com/get_video_info?docid=FILE_ID并获取fmt_stream_map链接,但这不会返回我需要的重定向程序链接.
解决方法:
他正在谈论从谷歌驱动器获取所有品质的360p,480p,720p,1080p并在/ videoplayback之前转换为redirector.googlevideo.com,并将其作为视频/ mp4在JW Player中播放.我有完整的脚本,但它有一个小问题,它说禁止403,这是因为谷歌在API中的变化.看看PHP中的代码,让我知道如果有人可以修复它,我将在以后发布完整的脚本.
function Drive($link) {
$url = urldecode($link);
$get = curl1($url);
$data = explode(',["fmt_stream_map","', $get);
$data = explode('"]', $data[1]);
$data = str_replace(array('\u003d', '\u0026'), array('=', '&'), $data[0]);
$data = explode(',', $data);
asort($data);
foreach($data as $list) {
$data2 = explode('|', $list);
if($data2[0] == 37) {$q1080p = preg_replace("/\/[^\/]+\.google\.com/","/redirector.googlevideo.com",$data2[1]);} // 1080P
if($data2[0] == 22) {$q720p = preg_replace("/\/[^\/]+\.google\.com/","/redirector.googlevideo.com",$data2[1]);} // 720P
if($data2[0] == 59) {$q480p = preg_replace("/\/[^\/]+\.google\.com/","/redirector.googlevideo.com",$data2[1]);} // 480P
if($data2[0] == 18) {$q360p = preg_replace("/\/[^\/]+\.google\.com/","/redirector.googlevideo.com",$data2[1]);} // 360P
}
$js[0][0] = "$q1080p";
$js[0][1] = "$q720p";
$js[0][2] = "$q480p";
$js[0][3] = "$q360p";
$js[1][0] = "1080P";
$js[1][1] = "720P";
$js[1][2] = "480P";
$js[1][3] = "360P";
return $js;
}
if ($jw[0][0] != "") {
echo('{file: "'.urldecode($jw[0][0]).'",type: "video/mp4",label: "'.urldecode($jw[1][0]).'"},');
}
if ($jw[0][1] != "") {
echo('{file: "'.urldecode($jw[0][1]).'",type: "video/mp4",label: "'.urldecode($jw[1][1]).'"},');
}
if ($jw[0][2] != "") {
echo('{file: "'.urldecode($jw[0][2]).'",type: "video/mp4",label: "'.urldecode($jw[1][2]).'"},');
}
if ($jw[0][3] != "") {
echo('{file: "'.urldecode($jw[0][3]).'",type: "video/mp4",label: "'.urldecode($jw[1][3]).'"},');
}