Skip to content

Instantly share code, notes, and snippets.

@juanpablocs
Created March 31, 2020 03:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save juanpablocs/10469d278c308c3542002f52de1b06f0 to your computer and use it in GitHub Desktop.
Save juanpablocs/10469d278c308c3542002f52de1b06f0 to your computer and use it in GitHub Desktop.
Google drive php 2020
<?php
/*
https://redirector.googlevideo.com/videoplayback?
id=62705830c2bbd616&
itag=22&
source=youtube&
requiressl=yes&
ei=G5-CXpqzGIn6Wa3MvvAB&
susc=ytcp&
mime=video/mp4&
dur=7716.246&
lmt=1585551863574129&
txp=2221222&
cmo=secure_transport=yes&
ip=0.0.0.0&
ipbits=0&
expire=1585647515&
sparams=ip,ipbits,expire,id,itag,source,requiressl,ei,susc,mime,dur,lmt&
signature=12031F375A6227A56392D2CA3CB569C9A79E29488B85A9CA547C8512135CC675.A05303CF3D8ED31417940D28E90469BF42750332781E544844C9BF75CD294E1E&
key=us0&
access=8%2F2czS2kyHSgKNlycFUQpg9Wj%2BbciFbwAOf2C%2F1anqy8P6IdTtF5Oxly2nArlaXPifQC2iZocmB8whWFdmYp8W
*/
function qualities($k) {
$o[18] = '360p';
$o[22] = '720p';
$o[37] = '1080p';
$o[59] = '480p';
return $o[$k];
}
// $url = "https://youtube.googleapis.com/get_video_info?video_id=1TRlSHk9iYRDFd1DYgoWBzkQPBAJFY78M";
$url = "https://docs.google.com/feeds/get_video_info?docid=1TRlSHk9iYRDFd1DYgoWBzkQPBAJFY78M&allow_embed=1";
$content = file_get_contents($url);
parse_str($content, $out);
$items = explode(",", $out["fmt_stream_map"]);
foreach($items as $item) {
list($k, $u) = explode('|', $item);
$q = qualities($k);
$o[$q] = preg_replace("/\/[^\/]+\.google\.com/", "/redirector.googlevideo.com", $u);
}
var_dump($o);
@EduardoMateus
Copy link

Does this method still work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment