12

I am trying In Google Drive, how can you link directly to "Download" a zip file and not view the contents? but it does not work. I am not sure on how to repeat the question. It downloads a 'file is too big to be antivirus scanned' warning HTML and when I try https://drive.google.com/uc?export=download&confirm=no_antivirus&id= it still downloads that.

Edit: I tried to wget --save-cookies /tmp/cookie.txt --load-cookies /tmp/cookie.txt and repeat it, still no dice.

  • 1
    Did you ever figure this out? Running into the same problem with bigger files. – Travis Reeder Mar 18 '14 at 19:31
  • No, I gave up on this. – chx Mar 18 '14 at 20:50
  • Very similar question from Stack Overflow, with good answers: "wget/curl large file from google drive" – tanius Feb 8 at 14:40
4

A cookie must match the "confirm" url parameter, and it is changed on each call.

Here's a perl script to download these files in an unattended way.

With the url from the antivirus scan warning page (https://drive.google.com/uc?export=download&confirm=s5vl&id=XXX) this code should be enough:

#!/usr/bin/perl
use strict;
my $TEMP='/tmp';my $COMMAND;my $confirm;
sub execute_command();
my $URL=shift;my $FILENAME=shift;
$FILENAME='gdown' if $FILENAME eq '';
execute_command();
if (-s $FILENAME < 100000) { # only if file isn't the download yet
    open fFILENAME, '<', $FILENAME;
    foreach (<fFILENAME>) {
        if (/confirm=([^;&]+)/) {
            $confirm=$1; last;   }    }
    close fFILENAME;
    $URL=~s/confirm=([^;&]+)/confirm=$confirm/;
    execute_command();    }
sub execute_command() {
    $COMMAND="wget --no-check-certificate --load-cookie $TEMP/cookie.txt --save-cookie $TEMP/cookie.txt \"$URL\"";
    $COMMAND.=" -O \"$FILENAME\"" if $FILENAME ne '';
    `$COMMAND`; return 1;    }
  • I've made a python script, and my cookie matches the confirm parameter in the url. However, it does not work: I am being redirected to a page titled "Sign in - Google Accounts". – Benjamin Toueg Feb 12 '15 at 11:32
  • Benjamin: you may need to process the url twice... look how the script calls execute_command() twice. – circulosmeos Mar 7 '15 at 16:49
2

After spending many countless hours trying to get a direct download link that bypasses the virus scan I finally figured it out by accident. A URL in the format below along with your Google API key will bypass the virus scan. I could not find this documented anywhere (here is the official doc) so use at your own risk as future updates might break it. https://www.googleapis.com/drive/v3/files/fileid/?key=yourapikey&alt=media

0

Try this

You can download these files to your computer in the following formats:

For documents: HTML, RTF, Word, Open Office, PDF, Text file.
For spreadsheets: CSV, HTML, ODS, PDF, XLS, TXT (only for a single sheet)
For presentations: PDF, PPTX, TXT
For drawings: PNG, JPEG, SVG, PDF

Download a file to your computer from Google Drive

Click the checkbox(es) next to the item(s) that you'd like to download.
Expand the More drop-down menu, and select Download...
Select a file format to which you'd like convert and download your item, such as Microsoft Word. If you select multiple items, they'll be

compressed into a .zip file Click Download.

You can also download a file when you're viewing the file. Go to the File menu, point your mouse to Download as, and select a file format.

If total file is above 2GB I don't think you'll be able to download without breaking into batches.

  • alas, it's a binary file :( neither of the above. – chx Apr 25 '13 at 2:05
0

Ok, Google uses the following URL format for the final download link:

https://drive.google.com/uc?export=download&confirm=s5vl&id=XXX

Notice the confirm parameter which seems to change every time you go to the original link. Maybe it's a short lived token or cookie matching or something?

0

I simply create a javascript so that it automatically capture the link and download and close the tab with the help of tampermonkey.

// ==UserScript==
// @name         Bypass Google drive virus scan
// @namespace    SmartManoj
// @version      0.1
// @description  Quickly get the download link
// @author       SmartManoj
// @match        https://drive.google.com/uc?id=*&export=download*
// @grant        none
// ==/UserScript==

function sleep(ms) {
  return new Promise(resolve => setTimeout(resolve, ms));
}

async function demo() {
    await sleep(5000);
    window.close();
}

(function() {
    location.replace(document.getElementById("uc-download-link").href);
    demo();
})();

protected by Community Jun 12 '18 at 22:00

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.