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;    }
Answer from circulosmeos on Stack Exchange
🌐
Google Sites
sites.google.com › site › gdocs2direct
Google Drive Direct Link Generator
That page will have a button to download the file. ... Step 4: Paste that link into the text box above and click "Create Direct Link" to create your link. Enjoy! This site takes your sharing URL, which is a URL that looks something like this: ...
🌐
Paperform
paperform.co › templates › apps › direct-download-link-google-drive
Google Drive Direct Download Link Generator | Paperform
Generating direct downloads from Google Drive can be a pain. That’s why we used Papeform to put together a tool that does this for you automatically. See it for yourself below. Continue with the guide to learn how to use it. ... We created this handy tool to help you quickly create direct download links for files stored in Google Drive.
🌐
Medium
medium.com › @saurabh.sde › fast-and-easy-ways-to-download-large-google-drive-files-or-folders-ad9985a04ed9
Fast and Easy ways to Download Large Google Drive Files or Folders | by Saurabh Sonker | Medium
December 30, 2022 - You should use Google Takeout if you are closing your account and want to export all data. That’s all for now. Do try gdown — it is really great when downloading larger files like courses, movies, zip, etc. Do share with others if you find this helpful. For any suggestions or issues, you can connect with me on LinkedIn.
🌐
Google Support
support.google.com › drive › thread › 304937875 › how-to-enable-direct-download-links-for-large-files-on-google-drive
How to Enable Direct Download Links for Large Files on Google Drive? - Google Drive Community
Google Drive · Privacy Policy · Terms of Service · Submit feedback · Send feedback on... This help content & information · General Help Center experience · Next · Help Center · Community · Find, delete, and recover files · Google Drive · false · Search ·
🌐
Ayrshare
ayrshare.com › home › how to get direct download urls from google drive
How to Get Direct Download URLs from Google Drive
March 6, 2025 - Learn how to convert Google Drive sharing links into direct download URLs for programmatic access and API integrations. With code examples.
🌐
ChemiCloud Blog
chemicloud.com › blog › download google drive files using wget: a step-by-step guide
Download Google Drive Files Using WGET: A Step-by-Step Guide
May 31, 2023 - The direct download link will look ... · Copy the file id from the download URL 1UibyVC_C2hoT_XEw15gPEwPW4yFyJFeOEA , as you will need it later while using the wget command. You can use the wget command to download Google Drive files now that you have the direct download URL...
🌐
Quora
quora.com › How-do-I-create-a-direct-download-link-for-a-Google-Drive-large-file
How to create a direct download link for a Google Drive large file - Quora
Answer: You can simply convert https://drive.google.com/file/d/file-id/view?usp=drivesdk To https://drive.google.com/uc?export=download&id=file-id But this trick will work for small files only.
Find elsewhere
🌐
Hows.tech
hows.tech › p › google-drive-download-link-generator.html
Google Drive Download Link Generator Online
Right-click on the file and select "Get Link". In the "Share Link" window, make sure that the "Anyone with the link can view" option is selected. Click on "Copy Link". Come back to this tool Google Drive Direct Download Link Generator.
🌐
Chrome Web Store
chromewebstore.google.com › detail › google-drive-direct-link › ebfajbnnlkjdogmocghbakjbncbgiljb
Google Drive Direct Link Generator - Chrome Web Store
Follows recommended practices for Chrome extensions. Learn more.Featured4.0( ... Ratings are updated daily and may not reflect the most recent reviews. ... Instantly convert Google Drive links into direct download URLs with this handy extension. A simple, user-friendly extension that transforms your Google Drive file links into direct download URLs.
Top answer
1 of 16
807

Update: Mars 2025

You can use gdown. Consider also visiting that page for full instructions; this is just a summary and the source repo may have more up-to-date instructions.


Instructions

Install it with the following command:

pip install gdown

After that, you can download any file from Google Drive by running one of these commands:

gdown https://drive.google.com/uc?id=<file_id>  # for files
gdown <file_id>                                 # alternative format
gdown --folder https://drive.google.com/drive/folders/<file_id>  # for folders
gdown --folder --id <file_id>                                   # this format works for folders too

Example: to download the readme file from this directory

gdown https://drive.google.com/uc?id=0B7EVK8r0v71pOXBhSUdJWU1MYUk

The file_id should look something like 0Bz8a_Dbh9QhbNU3SGlFaDg. You can find this ID by right-clicking on the file of interest, and selecting Get link. As of November 2021, this link will be of the form:

# Files
https://drive.google.com/file/d/<file_id>/view?usp=sharing
# Folders
https://drive.google.com/drive/folders/<file_id>

Caveats

  • Only works on open access files. ("Anyone who has a link can View")
  • Cannot download more than 50 files into a single folder.
    • If you have access to the source file, you can consider using tar/zip to make it a single file to work around this limitation.
2 of 16
228

I wrote a Python snippet that downloads a file from Google Drive, given a shareable link.

The snipped does not use gdrive, nor the Google Drive API. It uses the requests module.

When downloading large files from Google Drive, a single GET request is not sufficient. A second one is needed, and this one has an extra URL parameter called confirm, whose value should equal the value of a certain cookie.

import requests

def download_file_from_google_drive(id, destination):
    def get_confirm_token(response):
        for key, value in response.cookies.items():
            if key.startswith('download_warning'):
                return value

        return None

    def save_response_content(response, destination):
        CHUNK_SIZE = 32768

        with open(destination, "wb") as f:
            for chunk in response.iter_content(CHUNK_SIZE):
                if chunk: # filter out keep-alive new chunks
                    f.write(chunk)

    URL = "https://docs.google.com/uc?export=download"

    session = requests.Session()

    response = session.get(URL, params = { 'id' : id }, stream = True)
    token = get_confirm_token(response)

    if token:
        params = { 'id' : id, 'confirm' : token }
        response = session.get(URL, params = params, stream = True)

    save_response_content(response, destination)    


if __name__ == "__main__":
    import sys
    if len(sys.argv) is not 3:
        print("Usage: python google_drive.py drive_file_id destination_file_path")
    else:
        # TAKE ID FROM SHAREABLE LINK
        file_id = sys.argv[1]
        # DESTINATION FILE ON YOUR DISK
        destination = sys.argv[2]
        download_file_from_google_drive(file_id, destination)
🌐
How-To Geek
howtogeek.com › home › web › how to make a direct download link for google drive files
How to Make a Direct Download Link for Google Drive Files
September 28, 2023 - This workaround uses your shared file's ID in a custom link to enable direct download for your file. You can use this method on all your devices, including Windows, Mac, Linux, Chromebook, iPhone, iPad, and Android. We'll use a desktop web browser for the demonstration. Start by opening a web browser on your computer and accessing the Google Drive ...
🌐
Google Play
play.google.com › store › apps › details
Drive Direct Link Generator - Apps on Google Play
Discover the ultimate solution for hassle-free GDrive downloads with GDrive Direct Link. Whether your file is small or large, we've got you covered. For files under 100MB, enjoy seamless direct downloads without the need for a GDrive API key. Encounter a larger file?
🌐
Googledrivedownloader
googledrivedownloader.com
Google Drive Downloader - Google Drive Direct Link Generator
This Google Drive Downloader tool allows you to generate a direct download link to files you have stored in Google Drive. A direct link will immediately start downloading the file, rather than opening a preview of the file in Google Drive. Use Google Drive Downloader to generate direct download links for your files.
🌐
RaptorKit
raptorkit.com › home › google drive direct download link generator
Direct Download Link Generator: Google Drive Direct Download Link Generator
September 18, 2025 - Large Files May Require Compression: If you’re sharing a very large file (over 2 GB), it’s a good idea to compress it into a ZIP file. This reduces the file size and makes it easier for others to download.
🌐
Syncwithtech
syncwithtech.org › google-drive-direct-links
How to Get Direct Download Links for Google Drive Files
November 21, 2024 - This modification is simple and straightforward. Right-click a file in Google Drive, select Share → Copy link, and either manually alter it or paste it into the tool below to generate the direct download link.
🌐
Stack Overflow
stackoverflow.com › questions › 48257984 › how-to-direct-download-large-file-from-google-drive-without-google-drive-cant-s
ios - How to direct download large file from Google drive without Google Drive can't scan this file for viruses message - Stack Overflow
I then inspected download anyway button using Chrome and saw this link: https://drive.google.com/uc?export=download&confirm=9iBg&id=12cpUAP0wy8jyMD4-rjKJ23bicCJ29Cs- so I tried it to play audio using below func and it worked ...
🌐
Google Sites
sites.google.com › view › drive-tools › google-drive-direct-link-generator
Google Drive Tools - Google Drive Direct Link Generator
With a direct link, the file will download instantly, bypassing the preview page in Google Drive. Ensure your file's visibility in Google Drive is set to 'Anyone with the link.' If it's set to 'Restricted,' only users who are logged in and have access permissions can open the direct link, which might not be your intention. This tool works for uploaded files, not for documents created in Google Docs, Sheets, or Slides. For large ...
🌐
Bytesbin
bytesbin.com › google-drive-downloader
Google Drive Direct Downloader
Direct Download Google Drive Files. ... Bypass Drive Web View. ... Download Large PDFs, Audio Files, Images, and Other Media Files. Look for the file you want to download. Right-click on the file and click on the GET LINK.