
Direct Download Link for a Google Drive File
To get the direct download link for a Google Drive file, you can go to the Google Drive developers API references and use their “try it!” API explorer form for the get
API call. In the fileId
field, just paste the file’s ID and click “Execute”. Below under response, in the generated JSON, the direct link that you need is called webContentLink
and looks something like this:
1 2 |
"webContentLink": "https://docs.google.com/uc?id=0ByP7_A9vXm17TmRYcmNScnYzS1E&export=download" |
Download a Googe Drive File in Java
As part of out Datasets project, we need to download some database files that we have on Google Drive from within Java code. Using the direct link from above along with the org.apache.commons.io.FileUtils
class, this can be easily achieved.
1 |
org.apache.commons.io.FileUtils.copyURLToFile("https://docs.google.com/uc?id=0ByP7_A9vXm17TmRYcmNScnYzS1E&export=download", new File("/path/to/dir/"), 5000, 10000); |
Bypassing the Virus Scan Check on Google Drive
Unfortunately, as far as I can tell, this is not possible. There are many posts out there showing how it can be done, but after trying all of them, I’ve come to the conclusion, that Google has disabled this possibilty. As a workaround in our Datasets project, we have built in some logic that directs the client to download the file manually for the files that are too big for Google to run the virus scan on.
4 Comments
Vidya
This is really very good info.When i tried your method i am able to download a file,but i am getting junk data in that.
org.apache.commons.io.FileUtils.copyURLToFile(new URL(“https://docs.google.com/a/hiregrid.io/uc?id=0BxTOibOMb3uZQ1ZKUXNSYUNveUk&export=download”), new File(“/home/vidya/Desktop/test.doc”), 5000, 10000);
Zipdox
Bypassing the Virus Scan Check on Google Drive
I found a solution. Get the share link, go to it in incognito, click the download link and start downloading it, then go to downloads, disconnect from the internet (turn off WiFi or unplug cable), and click the link under the file name. Now copy that link. That is the direct download link. It worked for me.
Steve How
To know the process to get the direct download of the link from the google drive then you need to follow the guidelines from the help of the google drive tech help to maintain that.
akhgary
very nice. doesn’t require google drive API. thank you!