How to get direct Google Drive download link - ilya-khadykin/notes-outdated GitHub Wiki

This note is based on the blog post Google Drive direct download link creation for shared files

  1. First of all you have to upload the file to Google Drive

  2. Then you should get a shared link

  3. After that you should extract a unique file ID from generated link like this: drive_share_link

  4. Finally the only thing you should do to get a direct download link is to replace parts of generated shared link to the following ones:

https://docs.google.com/uc?id={FileID}&export=download
{FileID} - extracted earlier unique file ID (step 3)

You can switch docs for drive and &export=download doesn’t appear to be necessary.

https://drive.google.com/uc?id={FileID}
{FileID} - extracted earlier unique file ID (step 3)

Described above method uses documented API

  1. Download the file via console in Linux by issuing the following command:
curl -O -J -L https://drive.google.com/uc?id=0B4fIuYID3dr-aHY2eS1NcHdMeEU
# -O and -J together save the file using the server-specified filename rather than basing it on the URL
# -L has cURL follow the redirects it will encounter when accessing our link

Make sure you set appropriate access permission on Google Drive and the file is available to public