php script to generate direct links of publicly shared google drive files skipping virus scan warning
I founded many similar scrips doing so like
https://links-safety.com/drive/
https://linkstaker.com/drive/
they are exactly similar
what they reqire is only ID eg. 1C25uoL6nIqqNhex3wm8VwODsO2q2pXBt
https://links-safety.com/drive/i0yp6ymfgniv8lj1x6y8d7rj1
https://linkstaker.com/drive/download.php?id=86bc9a7559123e8982cf
they are not using api as the file url is just same as we click on download anyway button on virus scan page
If you know how to calculate the confirm code (here: CfLW), you can hotlink the file like this:
https://drive.google.com/uc?export=download&confirm=CfLW&id=1C25uoL6nIqqNhex3wm8VwODsO2q2pXBt
Otherwise you can get the hotlink by first downloading the warning page and looking for the hotlink/confirmation code inside that:
$input_lines = file_get_contents('https://drive.google.com/uc?id=1C25uoL6nIqqNhex3wm8VwODsO2q2pXBt&export=download');
preg_match_all("/confirm=([0-9A-Za-z]+)&/", $input_lines, $output_array);
$hotlink = 'https://drive.google.com/uc?export=download&confirm='.$output_array[1][0].'&id=1C25uoL6nIqqNhex3wm8VwODsO2q2pXBt