Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google drive direct link

Is there some kind direct links for google drive files, so I could download them by their links? Even temporary links would have been enough.

As I understood, webContentLink can be used only by browsers, downloadUrl can be used for small text files and shoud be used with something like XMLHttpRequest or something else.

like image 456
aptypr Avatar asked Apr 23 '13 11:04

aptypr


1 Answers

webContentLink and downloadUrl are the two main links you may use to download a Drive file.

  • downloadUrl requires you to authorize using OAuth 2.0 (append the access token to the URL using downloadUrl + "&access_token=" + access_token or using the Authorization HTTP header). It can be used to download files of Any size. Not sure what made you believe it's only for small text files. It's not. The downloadUrl is a temporary URL that is valid around 24h.
  • webContentLink requires the user to be signed in a Google Account. Basically, it uses cookie authorization which is why we usually say it's to be used in a browser. However there is another interesting use-case for that link: If your file is shared publicly then this link does not require any kind of authorization whereas downloadUrl still needs you to use an OAuth 2.0 access token. The webContentLink never expires.
like image 150
Nicolas Garnier Avatar answered Nov 15 '22 10:11

Nicolas Garnier