Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Download Google Drive files with WGET
Download Google Drive files with WGET
Example Google Drive download link:
https://docs.google.com/open?id=[ID]
To download the file with WGET you need to use this link:
https://googledrive.com/host/[ID]
Example WGET command:
wget -O file https://googledrive.com/host/[ID]
@chupzzz

This comment has been minimized.

Copy link

@chupzzz chupzzz commented Jul 19, 2017

It doesn't works as for 2017

@msn100001

This comment has been minimized.

Copy link

@msn100001 msn100001 commented Jul 27, 2017

This seems to work for one file.

wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O FILENAME

@pzyxian

This comment has been minimized.

Copy link

@pzyxian pzyxian commented Sep 1, 2017

still don't work somehow. I can't download a zip file with
wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O FILENAME

@Kjeanclaude

This comment has been minimized.

Copy link

@Kjeanclaude Kjeanclaude commented Oct 2, 2017

This doesn't work for me too. It seems that these download methods are obsolete.

@ABouenard

This comment has been minimized.

Copy link

@ABouenard ABouenard commented Oct 24, 2017

Good to know. Did you find any work-around? Thanks

@naufdotal

This comment has been minimized.

Copy link

@naufdotal naufdotal commented Oct 29, 2017

thanks, i can download the rar with
wget --no-check-certificate 👍

@gabrielstuff

This comment has been minimized.

Copy link

@gabrielstuff gabrielstuff commented Dec 18, 2017

wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O FILENAME works perfectly for publicly shared link.
Thanks ! 👍

@beliys

This comment has been minimized.

Copy link

@beliys beliys commented Jan 10, 2018

command for download any big file from google drive (for big file we need confirm download)
wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=FILEID" -O FILENAME && rm -rf /tmp/cookies.txt

@eltonplima

This comment has been minimized.

Copy link

@eltonplima eltonplima commented Jan 11, 2018

Thanks @beliys! Works perfectly!!

@luandro

This comment has been minimized.

Copy link

@luandro luandro commented Jan 24, 2018

Thanks for sharing. @beliys seems to work for files, but how do I make it work for a folder?

@murari023

This comment has been minimized.

Copy link

@murari023 murari023 commented Feb 1, 2018

Yes, this solution is working. Thank you @beliys

@mtarekcse

This comment has been minimized.

Copy link

@mtarekcse mtarekcse commented Feb 11, 2018

@beliys
Thanks

@sxs4337

This comment has been minimized.

Copy link

@sxs4337 sxs4337 commented Feb 20, 2018

@beliys
It worked fine for a single large file. Thanks.

@simmimourya

This comment has been minimized.

Copy link

@simmimourya simmimourya commented Feb 21, 2018

Works for a single large file :) Thanks! Saved my day.

@vladalive

This comment has been minimized.

Copy link

@vladalive vladalive commented Feb 22, 2018

I've used @beliys code and made a bash command.

Setup:

  1. Add this code to your ~/.bash_aliases file.
function gdrive_download () {
  CONFIRM=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate "https://docs.google.com/uc?export=download&id=$1" -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')
  wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$CONFIRM&id=$1" -O $2
  rm -rf /tmp/cookies.txt
}
  1. Open new bash session.

Usage:

gdrive_download long_google_drive_file_id filename.ext
@david2921

This comment has been minimized.

Copy link

@david2921 david2921 commented Feb 23, 2018

thank @vladalive

@mrandri19

This comment has been minimized.

Copy link

@mrandri19 mrandri19 commented Feb 24, 2018

thanks @vladalive

@RahulModi

This comment has been minimized.

Copy link

@RahulModi RahulModi commented Mar 3, 2018

Thank you @beliys

work perfect
command for download any big file from google drive (for big file we need confirm download)
wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O- | sed -rn 's/.confirm=([0-9A-Za-z_]+)./\1\n/p')&id=FILEID" -O FILENAME && rm -rf /tmp/cookies.txt

@mehdiahmed58

This comment has been minimized.

Copy link

@mehdiahmed58 mehdiahmed58 commented Mar 3, 2018

hi say me .. !! whats problem plz !!
capture

@Italjapan

This comment has been minimized.

Copy link

@Italjapan Italjapan commented Mar 13, 2018

thanks @vladalive

@kstoriadis

This comment has been minimized.

Copy link

@kstoriadis kstoriadis commented Mar 16, 2018

thanks @vladalive you are my only hero in this mess

@MaigoAkisame

This comment has been minimized.

Copy link

@MaigoAkisame MaigoAkisame commented Mar 28, 2018

Thanks @beliys, it worked! (03/28/2018)

@ccfiel

This comment has been minimized.

Copy link

@ccfiel ccfiel commented Apr 2, 2018

@beliys thanks!!! 💃

@vfdev-5

This comment has been minimized.

Copy link

@vfdev-5 vfdev-5 commented Apr 8, 2018

Thanks @beliys and @vladalive !

@yacineblr

This comment has been minimized.

Copy link

@yacineblr yacineblr commented Apr 9, 2018

Thanks @beliys @vladalive !!!!

@zdrav1

This comment has been minimized.

Copy link

@zdrav1 zdrav1 commented Apr 12, 2018

Thank you @beliys ! Works like a charm . I added also --user=username and --password='xxxxxx' and it works if File Link sharing is set 'on'
in google drive

@rokibhasansagar

This comment has been minimized.

Copy link

@rokibhasansagar rokibhasansagar commented Apr 26, 2018

Thank You @beliys
It works !

@DiegoIdeas

This comment has been minimized.

Copy link

@DiegoIdeas DiegoIdeas commented May 5, 2018

Hi based on this comments ... i create a bash to export a list of URL from file URLS.text to a URLS_DECODED.txt
an used in some accelerator like flashget ( i use cygwin to combine windows & linux )

Command spider was introduced to avoid download and get the final link ( directly )

Command GREP HEAD and CUT, process and get the final link, Is based in spanish language, maybe you could be port to ENGLISH LANGUAGE

echo -e "$URL_TO_DOWNLOAD\r" probably the \r is only cywin and must be replace by a \n (break line)
**********user*********** is the user folder
*******Localización*********** is in spanish language, clear the asterics and let the word in english Location and adapt THE HEAD and the CUT numbers to appropiate approach.


rm -rf /home/**********user***********/URLS_DECODED.txt
COUNTER=0
while read p; do 
	string=$p
    hash="${string#*id=}"
    hash="${hash%&*}"
    hash="${hash#*file/d/}"
    hash="${hash%/*}"
    let COUNTER=COUNTER+1
    echo "Enlace "$COUNTER" id="$hash
    URL_TO_DOWNLOAD=$(wget --spider --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id='$hash -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id="$hash 2>&1 | grep *******Localización***********: | head -c-13 | cut -c16-)
    rm -rf /tmp/cookies.txt
    echo -e "$URL_TO_DOWNLOAD\r" >> /home/**********user***********/URLS_DECODED.txt
    echo "Enlace "$COUNTER" URL="$URL_TO_DOWNLOAD
done < /home/**********user***********/URLS.txt```
@OneCDOnly

This comment has been minimized.

Copy link

@OneCDOnly OneCDOnly commented May 11, 2018

@beliys, another happy camper here. Good work! 👍

@mutegdp

This comment has been minimized.

Copy link

@mutegdp mutegdp commented May 15, 2018

Thank you @beliys , its works

@SpJam

This comment has been minimized.

Copy link

@SpJam SpJam commented May 16, 2018

Thanks @vladalive and @beliys !!

Download from local to Azure 5MB/s
Download from Google to Azure 172MB/s

very long time saved!

@shermster

This comment has been minimized.

Copy link

@shermster shermster commented May 21, 2018

Thanks @beliys! Works perfectly.

@louisophie

This comment has been minimized.

Copy link

@louisophie louisophie commented Jun 6, 2018

Thanks so much.^_^

@NOOYA

This comment has been minimized.

Copy link

@NOOYA NOOYA commented Jun 11, 2018

Thanks @beliys

@hexbinoct

This comment has been minimized.

Copy link

@hexbinoct hexbinoct commented Jun 16, 2018

what I got from google drive (shareable link) was this:
https://drive.google.com/open?id=ID
changed it to:
wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=ID' -O FILENAME

after this you will get a file named FILENAME in the directory, rename it to your liking.

@glennparris

This comment has been minimized.

Copy link

@glennparris glennparris commented Jul 18, 2018

This is what I use to get a file available as a linked file from googledrive using a Batch file
I use a lot of parameters but it always works. I've explained the parameters below.
Used Escape charaters (^) used because of the batch file

Find and use the proper filename (--content-disposition)
Into a directory called c:\mydirectory\temp (--directory-prefix=^"c:\mydirectory\temp^")
Try 10 times for a successful download (--tries=10)
Don't check for a certificate (--no-check-certificate)
Give me full error listing (nv)
Put the error listing in a file called c:\reports\YY.MM.DD_wget.txt
(--append-output=c:\reports%date:-4,4%.%date:-7,2%.%date:~-10,2%_wget.txt)
Finally
Run wget command (Wgwet https://drive.google.com/uc?export=download^&id= ????????????????????)

So single full line is below:

wget.exe --content-disposition --directory-prefix=^"c:\mydirectory\temp^" --tries=10 --no-check-certificate -nv --append-output=c:\reports%date:-4,4%.%date:-7,2%.%date:~-10,2%_wget.txt https://drive.google.com/uc? export=download^&id=???????????????????????????????

@dshamaeli

This comment has been minimized.

Copy link

@dshamaeli dshamaeli commented Aug 3, 2018

thank you @beliys

@abumaryam

This comment has been minimized.

Copy link

@abumaryam abumaryam commented Aug 5, 2018

Thanks @vladalive and @beliys it works

@purbojati

This comment has been minimized.

Copy link

@purbojati purbojati commented Aug 6, 2018

anyone who don't understand @beliys . He it is you must change FILEID with your Google Drive file ID. It appear in URL. Also FILENAME change with your new file name. Be sure to include extension like .zip 💯

@kingsj0405

This comment has been minimized.

Copy link

@kingsj0405 kingsj0405 commented Aug 15, 2018

@vladalive nice work!

@oguntola2018

This comment has been minimized.

Copy link

@oguntola2018 oguntola2018 commented Aug 20, 2018

thanks you all,
wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O FILENAME didnt work for me for .rar file but adding thr retry option got it working

this worked. thanks
wget --no-check-certificate -r 'https://docs.google.com/uc?export=download&id=FILEID' -O FILENAME

@GitHub30

This comment has been minimized.

Copy link

@GitHub30 GitHub30 commented Aug 28, 2018

curl gdrive.sh | bash -s FILEID

https://github.com/GitHub30/gdrive.sh

@bhollan

This comment has been minimized.

Copy link

@bhollan bhollan commented Sep 3, 2018

Thanks to all! @beliys, @vladalive, and @GitHub30!

@Gibigbig

This comment has been minimized.

Copy link

@Gibigbig Gibigbig commented Sep 15, 2018

thanks you all,
wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O FILENAME didnt work for me for .rar file but adding thr retry option got it working

this worked. thanks
wget --no-check-certificate -r 'https://docs.google.com/uc?export=download&id=FILEID' -O FILENAME

thanks this worked 2018

@marcelofeb

This comment has been minimized.

Copy link

@marcelofeb marcelofeb commented Sep 18, 2018

Thanks!
But i have one question, someone know how download large files in wget for Windows?
i try alot command whitout success.

@mzramna

This comment has been minimized.

Copy link

@mzramna mzramna commented Sep 20, 2018

https://github.com/mzramna/easy-google-drive-downloader this one i've made uses the upper logics with sed to make it easyer to be used,but in future i will update it to python and give more functionality

@mzramna

This comment has been minimized.

Copy link

@mzramna mzramna commented Sep 20, 2018

Thanks!
But i have one question, someone know how download large files in wget for Windows?
i try alot command whitout success.

nowdays you can download ubuntu(or other linux) terminal into windows 10 appstore ,so just use those codes into it

@MaxLing

This comment has been minimized.

Copy link

@MaxLing MaxLing commented Oct 4, 2018

thanks @vladalive and @beliys

@HuaxuanGAO

This comment has been minimized.

Copy link

@HuaxuanGAO HuaxuanGAO commented Oct 11, 2018

Thanks @vladalive!
Solution given by @beliys reports illegal variable name, no idea why

@pavanjadhaw

This comment has been minimized.

Copy link

@pavanjadhaw pavanjadhaw commented Oct 20, 2018

gdown

I am able to download large files from gdrive using this perl script.
You can pass the filelink and filname to it.

wget https://raw.githubusercontent.com/pavanjadhaw/gdown.pl/master/gdown.pl && chmod u+x gdown.pl

then

./gdown.pl "link to file" file.mp4

@haghshenas

This comment has been minimized.

Copy link

@haghshenas haghshenas commented Oct 22, 2018

@tall-josh

This comment has been minimized.

Copy link

@tall-josh tall-josh commented Nov 4, 2018

Thanks @beliys and @vladalive !

@andrea-simonelli-research

This comment has been minimized.

Copy link

@andrea-simonelli-research andrea-simonelli-research commented Nov 9, 2018

gdown

I am able to download large files from gdrive using this perl script.
You can pass the filelink and filname to it.

wget https://raw.githubusercontent.com/pavanjadhaw/gdown.pl/master/gdown.pl && chmod u+x gdown.pl

then

./gdown.pl "link to file" file.mp4

This worked for me! I noticed that in @haghshenas 's answer (https://stackoverflow.com/a/32441141/2345493) you must allow the owner of the code to do whatever he wants to your google drive account. I prefer not do do that! This script does the job without risks.

@ghost

This comment has been minimized.

Copy link

@ghost ghost commented Nov 19, 2018

@munaAchyuta

This comment has been minimized.

Copy link

@munaAchyuta munaAchyuta commented Nov 21, 2018

@inishchith

This comment has been minimized.

Copy link

@inishchith inishchith commented Jan 14, 2019

@hongsukchoi

This comment has been minimized.

Copy link

@hongsukchoi hongsukchoi commented Feb 21, 2019

for mac users,

change sed to gsed

wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O- | gsed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=FILEID" -O FILENAME && rm -rf /tmp/cookies.txt

@guysmoilov

This comment has been minimized.

Copy link

@guysmoilov guysmoilov commented Feb 28, 2019

Had to modify it slightly to work on Mac AND google drive instead of docs: https://gist.github.com/guysmoilov/ff68ef3416f99bd74a3c431b4f4c739a

@xuannianc

This comment has been minimized.

Copy link

@xuannianc xuannianc commented Mar 8, 2019

@vladalive and @beliys, thank you guys.

@khnwr

This comment has been minimized.

Copy link

@khnwr khnwr commented Mar 13, 2019

terimakasih

@nielsboecker

This comment has been minimized.

Copy link

@nielsboecker nielsboecker commented Mar 27, 2019

thanks @vladalive and @beliys

@harrisonyi

This comment has been minimized.

Copy link

@harrisonyi harrisonyi commented Mar 28, 2019

thanks you all,
wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O FILENAME didnt work for me for .rar file but adding thr retry option got it working

this worked. thanks
wget --no-check-certificate -r 'https://docs.google.com/uc?export=download&id=FILEID' -O FILENAME

thanks for my .zip file

@novioleo

This comment has been minimized.

Copy link

@novioleo novioleo commented Mar 29, 2019

thks for @vladalive

@frmoronari

This comment has been minimized.

Copy link

@frmoronari frmoronari commented Apr 5, 2019

thx @GitHub30
Very nice!

@cronfy

This comment has been minimized.

Copy link

@cronfy cronfy commented Apr 22, 2019

thanks @vladalive, it worked!

@zeeshansayyed

This comment has been minimized.

Copy link

@zeeshansayyed zeeshansayyed commented May 7, 2019

thanks @vladalive and @beliys
This problem was driving me crazy for a long time.

@vladalive

This comment has been minimized.

Copy link

@vladalive vladalive commented May 16, 2019

OMG, I didn't realize it was so much helpful for all of you guys!
You are most welcome!
@david2921 @mrandri19 @Italjapan @kstoriadis @vfdev-5 @yacineblr @SpJam @abumaryam @kingsj0405 @bhollan @MaxLing @HuaxuanGAO @tall-josh @xuannianc @nbckr @novioleo @cronfy @zeeshansayyed

@vladalive

This comment has been minimized.

Copy link

@vladalive vladalive commented May 16, 2019

@divyam-goel

This comment has been minimized.

Copy link

@divyam-goel divyam-goel commented May 22, 2019

thank you @beliys

@ChandanVerma

This comment has been minimized.

Copy link

@ChandanVerma ChandanVerma commented May 28, 2019

command for download any big file from google drive (for big file we need confirm download)
wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=FILEID" -O FILENAME && rm -rf /tmp/cookies.txt

works for me too... Thanks :)

@Harrypotterrrr

This comment has been minimized.

Copy link

@Harrypotterrrr Harrypotterrrr commented May 30, 2019

Hi, there is still a problem with @beliys solution:
Take this large file as an example: link is here https://drive.google.com/uc?id=0B_B_FOgPxgFLRjdEdE9NNTlzUWc
I use the following command,

wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=0B_B_FOgPxgFLRjdEdE9NNTlzUWc' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=0B_B_FOgPxgFLRjdEdE9NNTlzUWc" -O myfile.mat

Note that I delete && rm -rf /tmp/cookie since I have no permission to delete the file in /tmp
Then I fetch a html file rather than my target large file.
So can anyone help me to figure it out? (btw, I use @GitHub30 solution, and it works! Appreciate very much!)

@siamware

This comment has been minimized.

Copy link

@siamware siamware commented Jun 1, 2019

wget --load-cookies cookies.txt "https://drive.google.com/uc?authuser=0&id=$1&export=download" -O $2
it work

@eduardoalthaus

This comment has been minimized.

Copy link

@eduardoalthaus eduardoalthaus commented Jun 5, 2019

thanks you all,
wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O FILENAME didnt work for me for .rar file but adding thr retry option got it working

this worked. thanks
wget --no-check-certificate -r 'https://docs.google.com/uc?export=download&id=FILEID' -O FILENAME

Great! It worked.
Thanks.

@MittalShruti

This comment has been minimized.

Copy link

@MittalShruti MittalShruti commented Jun 12, 2019

Thank You @beliys !!

@mikeguidry

This comment has been minimized.

Copy link

@mikeguidry mikeguidry commented Jun 14, 2019

I've made some mods.. The current one was failing on a slow connection after awhile with a google returned text/html page (confirmation, or cookie expire, or something)... This one has some redundancy, and verifies the download on resume...
https://gist.github.com/mikeguidry/8bf7b2116f92978fb02283035b9ddb81
:)
give all credit to original authors... they did the hard part (getting cookie, etc)

Edit: oh mine also allows setting bandwidth by..
gdrive_dl BW:100 gdrive_id output.zip

@zihaozhang9

This comment has been minimized.

Copy link

@zihaozhang9 zihaozhang9 commented Jun 14, 2019

从谷歌驱动器下载任何大文件的命令(对于大文件,我们需要确认下载)
wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=FILEID" -O FILENAME && rm -rf /tmp/cookies.txt

Sorry! I don't seem to be able to use the command. Can you help me?

mini_imagenet_test.pickle in https://drive.google.com/drive/folders/15WuREBvhEbSWo4fTr1r-vMY0C_6QWv4w
FILEID = 1XyjEGP8IaQ8fZ4rsPndqbB1mg1sZZmKP

I use wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate "https://docs.google.com/uc?export=download&id=1XyjEGP8IaQ8fZ4rsPndqbB1mg1sZZmKP" -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=1XyjEGP8IaQ8fZ4rsPndqbB1mg1sZZmKP" -O FILENAME && rm -rf /tmp/cookies.txt

log:--2019-06-14 22:32:01-- https://docs.google.com/uc?export=download&confirm=8Q06&id=1XyjEGP8IaQ8fZ4rsPndqbB1mg1sZZmKP Resolving docs.google.com (docs.google.com)... 216.58.200.78, 2404:6800:4005:811::200e Connecting to docs.google.com (docs.google.com)|216.58.200.78|:443... connected. HTTP request sent, awaiting response... 200 OK Length: unspecified [text/html] Saving to: 'FILENAME' FILENAME [ <=> ] 3.21K --.-KB/s in 0.003s 2019-06-14 22:32:02 (1.15 MB/s) - 'FILENAME' saved [3290]

The file I downloaded is only 4kb

@mikeguidry

This comment has been minimized.

Copy link

@mikeguidry mikeguidry commented Jun 15, 2019

You received thehtml/text problem I had ran into.. check out my version. It checks for that before saving to the file, or overwriting the resume file..
https://gist.github.com/mikeguidry/8bf7b2116f92978fb02283035b9ddb81

@zihaozhang9

This comment has been minimized.

Copy link

@zihaozhang9 zihaozhang9 commented Jun 15, 2019

你收到我遇到的HTML /文本问题..看看我的版本。它会在保存到文件之前检查,或者覆盖恢复文件..
https://gist.github.com/mikeguidry/8bf7b2116f92978fb02283035b9ddb81

Thank you very much. I am using bash command : gdrive_dl.sh 1XyjEGP8IaQ8fZ4rsPndqbB1mg1sZZmKP mini_imagenet_test.pickle

The following log is printed cyclically. I think maybe it’s my network connection problem.
log:


--2019-06-15 10:51:13-- https://docs.google.com/uc?export=download&confirm=lP3z&id=1XyjEGP8IaQ8fZ4rsPndqbB1mg1sZZmKP
Resolving docs.google.com (docs.google.com)... 172.217.161.174, 2404:6800:4005:80f::200e
Connecting to docs.google.com (docs.google.com)|172.217.161.174|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: 'ab2ce63b3c7e0a8c09028e11cc9a6cee.tmp'
0K .......... .......... .......... .......... 167K=0.2s
2019-06-15 10:51:13 (167 KB/s) - 'ab2ce63b3c7e0a8c09028e11cc9a6cee.tmp' saved [41793]


--2019-06-15 10:51:14-- https://docs.google.com/uc?export=download&confirm=sWSi&id=1XyjEGP8IaQ8fZ4rsPndqbB1mg1sZZmKP
Resolving docs.google.com (docs.google.com)... 172.217.161.174, 2404:6800:4005:80f::200e
Connecting to docs.google.com (docs.google.com)|172.217.161.174|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: 'ab2ce63b3c7e0a8c09028e11cc9a6cee.tmp'
0K .......... .......... .......... .......... 173K=0.2s
2019-06-15 10:51:15 (173 KB/s) - 'ab2ce63b3c7e0a8c09028e11cc9a6cee.tmp' saved [41793]


@mikeguidry

This comment has been minimized.

Copy link

@mikeguidry mikeguidry commented Jun 15, 2019

You seem to be getting the html/text response back continuously... I've tested your file here: https://drive.google.com/file/d/1XyjEGP8IaQ8fZ4rsPndqbB1mg1sZZmKP/edit
It exists..
mike@i  ~  gdrive_dl 1XyjEGP8IaQ8fZ4rsPndqbB1mg1sZZmKP mini_imagenet_test.pickle   10113  01:29:39
--2019-06-15 01:29:49-- https://docs.google.com/uc?export=download&confirm=SdRG&id=1XyjEGP8IaQ8fZ4rsPndqbB1mg1sZZmKP
Resolving docs.google.com (docs.google.com)... 172.217.14.174, 2607:f8b0:4000:816::200e
Connecting to docs.google.com (docs.google.com)|172.217.14.174|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://doc-0c-14-docs.googleusercontent.com/docs/securesc/ha0ro937gcuc7l7deffksulhg5h7mbp1/721ncci4vpbe37o6g7bcoc7vocun86a0/1560571200000/03442058075182384827/*/1XyjEGP8IaQ8fZ4rsPndqbB1mg1sZZmKP?e=download [following]
Warning: wildcards not supported in HTTP.
--2019-06-15 01:29:49-- https://doc-0c-14-docs.googleusercontent.com/docs/securesc/ha0ro937gcuc7l7deffksulhg5h7mbp1/721ncci4vpbe37o6g7bcoc7vocun86a0/1560571200000/03442058075182384827/*/1XyjEGP8IaQ8fZ4rsPndqbB1mg1sZZmKP?e=download
Resolving doc-0c-14-docs.googleusercontent.com (doc-0c-14-docs.googleusercontent.com)... 172.217.1.225, 2607:f8b0:4000:802::2001
Connecting to doc-0c-14-docs.googleusercontent.com (doc-0c-14-docs.googleusercontent.com)|172.217.1.225|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/octet-stream]
Saving to: ‘ab2ce63b3c7e0a8c09028e11cc9a6cee.tmp’

 0K .......... .......... .......... .......... .......... 26.2K
50K .......... .......... .......... .......... .......... 14.1K

100K .......... .......... .......... .......... .......... 17.1K
150K .......... .......... .......... .......... .......... 20.0K

works fine here... it must be something with google and your source ip address for some reason? I cannot think of any other reasoning honestly... maybe your locale could have different variable names for the confirmation? no clue... =/

@ankursharma129

This comment has been minimized.

Copy link

@ankursharma129 ankursharma129 commented Jul 31, 2019

command for download any big file from google drive (for big file we need confirm download)
wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=FILEID" -O FILENAME && rm -rf /tmp/cookies.txt

Works like a charm! Thanks man!

@ffabi

This comment has been minimized.

Copy link

@ffabi ffabi commented Jul 31, 2019

command for download any big file from google drive (for big file we need confirm download)
wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=FILEID" -O FILENAME && rm -rf /tmp/cookies.txt

Works perfectly, thanks!

@ellieandallen

This comment has been minimized.

Copy link

@ellieandallen ellieandallen commented Aug 20, 2019

thanks you all,
wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O FILENAME didnt work for me for .rar file but adding thr retry option got it working

this worked. thanks
wget --no-check-certificate -r 'https://docs.google.com/uc?export=download&id=FILEID' -O FILENAME

wow this worked,thank you for your sharing

@osuzdalev

This comment has been minimized.

Copy link

@osuzdalev osuzdalev commented Aug 20, 2019

pip install gdown

In terminal:
gdown --id FILEID -O FILENAME

In python:

import gdown

url = 'https://drive.google.com/uc?id=0B9P1L--7Wd2vU3VUVlFnbTgtS2c'
output = 'spam.txt'
gdown.download(url, output, quiet=False)

Can be found HERE

@latinofac

This comment has been minimized.

Copy link

@latinofac latinofac commented Aug 29, 2019

Thank You @beliys !!

One detail:

  • It works only if the file is on your drive, and not in a subfolder.
@Jostino

This comment has been minimized.

Copy link

@Jostino Jostino commented Sep 2, 2019

thanks @beliys and @vladalive
it's working

@dadodasyra

This comment has been minimized.

Copy link

@dadodasyra dadodasyra commented Sep 4, 2019

wget --no-check-certificate -r 'https://docs.google.com/uc?export=download&id=FILEID' -O FILENAME

Work on 2019 on Debian 9 in no root user

@War3Evo

This comment has been minimized.

Copy link

@War3Evo War3Evo commented Sep 5, 2019

What if you need to stop the download and resume it?

@sreekanthraju999

This comment has been minimized.

Copy link

@sreekanthraju999 sreekanthraju999 commented Sep 9, 2019

Thank you @beliys

@pidugusundeep

This comment has been minimized.

Copy link

@pidugusundeep pidugusundeep commented Sep 12, 2019

thanks, @beliys it works just fine for a file.

@r10a

This comment has been minimized.

Copy link

@r10a r10a commented Sep 17, 2019

Thanks, @dadodasyra. I had to go root on Ubuntu 1604 though. Not sure if it was a problem on my side.

@wj-zhang

This comment has been minimized.

Copy link

@wj-zhang wj-zhang commented Sep 20, 2019

Thanks a lot, @beliys

@crazygit

This comment has been minimized.

Copy link

@crazygit crazygit commented Sep 29, 2019

Thanks @beliys! Works perfectly!!!!!

@tensarflow

This comment has been minimized.

Copy link

@tensarflow tensarflow commented Oct 8, 2019

command for download any big file from google drive (for big file we need confirm download)
wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=FILEID" -O FILENAME && rm -rf /tmp/cookies.txt

Thank youuuuuuuuu

@qasimmughal0

This comment has been minimized.

Copy link

@qasimmughal0 qasimmughal0 commented Nov 18, 2019

Hi All,
I'm facing an error during verify the GDrive app on google account.
Can anyone guide me on how can I fix that? I'm using windows platform
Google Drive

@alex-tifox

This comment has been minimized.

Copy link

@alex-tifox alex-tifox commented Dec 8, 2019

thanks you all,
wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O FILENAME didnt work for me for .rar file but adding thr retry option got it working

this worked. thanks
wget --no-check-certificate -r 'https://docs.google.com/uc?export=download&id=FILEID' -O FILENAME

This worked for me in 2019. Thanks a lot!

@kikegoni

This comment has been minimized.

Copy link

@kikegoni kikegoni commented Dec 13, 2019

Hey, I have a .xlsx file and I have done also this:

wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O FILENAME

But obtaining this error:

HTTP request sent, awaiting response... 404 Not Found
2019-12-13 10:27:02 ERROR 404: Not Found.

Has anyone experienced a similar error? It's weird because when I have tried with other files only owned by me it works but with these shared files it is giving this error.

Any help would be appreciated.

@pidugusundeep

This comment has been minimized.

Copy link

@pidugusundeep pidugusundeep commented Dec 13, 2019

@kikegoni

Hey, I have a .xlsx file and I have done also this:

wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O FILENAME

But obtaining this error:

HTTP request sent, awaiting response... 404 Not Found
2019-12-13 10:27:02 ERROR 404: Not Found.

Has anyone experienced a similar error? It's weird because when I have tried with other files only owned by me it works but with these shared files it is giving this error.

Any help would be appreciated.

You can try this python module if you have python installed ( https://pypi.org/project/googleDriveFileDownloader/ ). or please post the file id so that we can help you give the URL for the file to download.

@kikegoni

This comment has been minimized.

Copy link

@kikegoni kikegoni commented Dec 13, 2019

Hey @pidugusundeep,

I have just figured it out. Probably it was because it is a google spreadsheet. It worked with:

wget --no-check-certificate 'https://docs.google.com/spreadsheets/export?format=xlsx&id=FILEID' -O FILENAME
@dxb22abad

This comment has been minimized.

Copy link

@dxb22abad dxb22abad commented Dec 15, 2019

not working for now

` wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=1bLRrBakT_fe_qRwu7DrAiSAM3Iw6AiaG' -O- | sed -rn 's/.confirm=([0-9A-Za-z_]+)./\1\n/p')&id=1bLRrBakT_fe_qRwu7DrAiSAM3Iw6AiaG" -O test && rm -rf /tmp/cookies.txt
--2019-12-15 16:01:36-- https://docs.google.com/uc?export=download&confirm=&id=1bLRrBakT_fe_qRwu7DrAiSAM3Iw6AiaG
Resolving docs.google.com (docs.google.com)... 64.233.165.194, 2a00:1450:4010:c08::c2
Connecting to docs.google.com (docs.google.com)|64.233.165.194|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘test’

test [ <=> ] 3.03K --.-KB/s in 0s

2019-12-15 16:01:37 (32.9 MB/s) - ‘test’ saved [3098]`

@aduartebdsol

This comment has been minimized.

Copy link

@aduartebdsol aduartebdsol commented Jan 23, 2020

wget --no-check-certificate -r 'https://docs.google.com/uc?export=download&id=FILEID' -O FILENAME

This works for me in 2020 hehe, thanks!

@sorob

This comment has been minimized.

Copy link

@sorob sorob commented Feb 8, 2020

wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O- | sed -rn 's/.confirm=([0-9A-Za-z_]+)./\1\n/p')&id=FILEID" -O FILENAME && rm -rf /tmp/cookies.txt

this worked for me :) thank you!

@willingnesshxl

This comment has been minimized.

Copy link

@willingnesshxl willingnesshxl commented Feb 10, 2020

wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O- | sed -rn 's/.confirm=([0-9A-Za-z_]+)./\1\n/p')&id=FILEID" -O FILENAME && rm -rf /tmp/cookies.txt

Thanks :D Works perfectly!

@arcps

This comment has been minimized.

Copy link

@arcps arcps commented Feb 12, 2020

While in my Arch Linux I was able to use "curl -LJO -C -" with the download URL to both auto get the file name and resume the download, in my Openwrt for some reason when I use the -LJO it refused to resume. So for anyone who might need, you can manually grab the file name like this:
wget:
filename=$(wget -q "https://drive.google.com/file/d/$FILEID/view" -O- | grep -oP "(?<=title': ').*?(?=',)" )

curl:
filename=$(curl --silent "https://drive.google.com/file/d/$FILEID/view" | grep -oP "(?<=title': ').*?(?=',)" )

@QihangGu

This comment has been minimized.

Copy link

@QihangGu QihangGu commented Mar 12, 2020

wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=1hun0tsel34aXO4CYyTRIvHJkcbZHwjrD' -O- | sed -rn 's/.confirm=([0-9A-Za-z_]+)./\1\n/p')&id=1hun0tsel34aXO4CYyTRIvHJkcbZHwjrD" -O cocobu_att.tar && rm -rf /tmp/cookies.txt
--2020-03-12 00:24:12-- https://docs.google.com/uc?export=download&confirm=&id=1hun0tsel34aXO4CYyTRIvHJkcbZHwjrD
Resolving docs.google.com (docs.google.com)... 2a00:1450:4009:806::200e, 216.58.204.14
Connecting to docs.google.com (docs.google.com)|2a00:1450:4009:806::200e|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘cocobu_att.tar’

cocobu_att.tar [ <=> ] 3.04K --.-KB/s in 0s

2020-03-12 00:24:12 (49.8 MB/s) - ‘cocobu_att.tar’ saved [3113]

It doesn't work for me now. The file is 23GB, but only 1MB html is received, showing that "Google Drive - Quota exceeded". Is there anyone could help solve this problem?

@susierao

This comment has been minimized.

Copy link

@susierao susierao commented Apr 8, 2020

pip install gdown

In terminal:
gdown --id FILEID -O FILENAME

In python:

import gdown

url = 'https://drive.google.com/uc?id=0B9P1L--7Wd2vU3VUVlFnbTgtS2c'
output = 'spam.txt'
gdown.download(url, output, quiet=False)

Can be found HERE

this is perfect!!! works like a charm! Thanks a lot!!

@dksifoua

This comment has been minimized.

Copy link

@dksifoua dksifoua commented Apr 12, 2020

hey @susiero

It works!! thank you

👍

@susierao

This comment has been minimized.

Copy link

@susierao susierao commented Apr 12, 2020

hey @susiero

It works!! thank you

👍

@dksifoua no problem. I was also super glad that a solution was found. Opps, I forgot to @osuzdalev, who originally posted the solution, lol. Thank you:-)

@maxsnet

This comment has been minimized.

Copy link

@maxsnet maxsnet commented Apr 24, 2020

thanks you all,
wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O FILENAME didnt work for me for .rar file but adding thr retry option got it working

this worked. thanks
wget --no-check-certificate -r 'https://docs.google.com/uc?export=download&id=FILEID' -O FILENAME

@oguntola2018 perfect!

@RaXorX

This comment has been minimized.

Copy link

@RaXorX RaXorX commented Jun 8, 2020

Welps, just when I was about to give it, I got it to work. Using MSys2
Cookies made with Export Cookies.txt, which I loaded inside the "C:\msys64\home{username}" folder. (I could make the tmp folder, but alas I couldn't get it to work nonethewise from within a folder due to some reason, msys didn't see the /tmp/cookies.txt and when i changed those to backslash it saw the file as tmpcookies.txt instead.)

Anyways, with a suggestion from someone (dev of IDM+ for android, Vicky Bonick) for the code, I managed to get it to work within windows.

wget --load-cookies cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --load-cookies cookies.txt --save-cookies cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=FILEID" -O FILENAME && rm -rf cookies.txt worked for me in windows using msys2, my file was restricted and tested it on 3 to 4 different files.

Now onto getting it to work with native windows binaries. :)

EDIT: Markdown.
Also, can anyone suggest a method to get the cookies through wget? I saw a method but it was for http not https, and failed for google.

@SPDurkee

This comment has been minimized.

Copy link

@SPDurkee SPDurkee commented Jun 10, 2020

As on June 9, 2020, this works and automatically extracts and saves the file to the correct filename!

wget --no-check-certificate -r 'https://docs.google.com/uc?export=download&id=FILEID' -O $(curl -s "https://drive.google.com/file/d/FILEID/view?usp=sharing" | grep -o '<title>.*</title>' | cut -d'>' -f2 | awk -F ' - Goo' '{print $1}')

Save the following into a text file, set execute permissions and you can call it from the command line, i.e. getgoogle FILEID
#!/bin/bash
wget --no-check-certificate -r "https://docs.google.com/uc?export=download&id=$1" -O $(curl -s "https://drive.google.com/file/d/$1/view?usp=sharing" | grep -o '<title>.*</title>' | cut -d'>' -f2 | awk -F ' - Goo' '{print $1}')

Enjoy!

@lysukhin

This comment has been minimized.

Copy link

@lysukhin lysukhin commented Jun 11, 2020

@SPDurkee it sure worked! Thank you.

@thomasflynn918

This comment has been minimized.

Copy link

@thomasflynn918 thomasflynn918 commented Jun 18, 2020

@SPDurkee brilliant! Thank you!

@mh4nx7net

This comment has been minimized.

Copy link

@mh4nx7net mh4nx7net commented Jun 22, 2020

curl gdrive.sh | bash -s FILEID

https://github.com/GitHub30/gdrive.sh

wouoww
thanks man!!

@liaogx

This comment has been minimized.

Copy link

@liaogx liaogx commented Jul 2, 2020

command for download any big file from google drive (for big file we need confirm download)
wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=FILEID" -O FILENAME && rm -rf /tmp/cookies.txt

It works perfectly! love you ^_^

@lsynergy

This comment has been minimized.

Copy link

@lsynergy lsynergy commented Jul 9, 2020

Well... the script and the gdown.pl as well didn't work well when I tried to download a 50GB-file from the google drive. It gets just a 3.1 KB file and that's it.

@feromes

This comment has been minimized.

Copy link

@feromes feromes commented Jul 10, 2020

pip install gdown

In terminal:
gdown --id FILEID -O FILENAME

In python:

import gdown

url = 'https://drive.google.com/uc?id=0B9P1L--7Wd2vU3VUVlFnbTgtS2c'
output = 'spam.txt'
gdown.download(url, output, quiet=False)

Can be found HERE

@osuzdalev perfect!!!!!

Once more proving how Python is a great Tool even for them who is not exactly involving with developing stuff.

@abdullathifkhumaidi

This comment has been minimized.

Copy link

@abdullathifkhumaidi abdullathifkhumaidi commented Jul 11, 2020

command for download any big file from google drive (for big file we need confirm download)
wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=FILEID" -O FILENAME && rm -rf /tmp/cookies.txt

This work properly when using to download big file in my own drive, but not working when using to download big file from someone that shared their drive to me. Perhaps someone can help me?

@beliys

This comment has been minimized.

Copy link

@beliys beliys commented Jul 12, 2020

command for download any big file from google drive (for big file we need confirm download)
wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=FILEID" -O FILENAME && rm -rf /tmp/cookies.txt

This work properly when using to download big file in my own drive, but not working when using to download big file from someone that shared their drive to me. Perhaps someone can help me?

I can download the files that I shared for me without any problems. Throw off the link in PM, I will try to see what you are doing wrong. Also throw off the full command that you tried to download.

@abdullathifkhumaidi

This comment has been minimized.

Copy link

@abdullathifkhumaidi abdullathifkhumaidi commented Jul 12, 2020

command for download any big file from google drive (for big file we need confirm download)
wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=FILEID" -O FILENAME && rm -rf /tmp/cookies.txt

This work properly when using to download big file in my own drive, but not working when using to download big file from someone that shared their drive to me. Perhaps someone can help me?

I can download the files that I shared for me without any problems. Throw off the link in PM, I will try to see what you are doing wrong. Also throw off the full command that you tried to download.

Hi Beliys,

This command that I use to download big file from someone that shared their drive to me.

wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=1pVSPdNaEYzMkk5MKay4WtcdFtIbKMlRh' -O- | sed -rn 's/.confirm=([0-9A-Za-z_]+)./\1\n/p')&id=1pVSPdNaEYzMkk5MKay4WtcdFtIbKMlRh" -O iosxrvk9.qcow2 && rm -rf /tmp/cookies.tx

Information about big file on drive
image

Error:
image

@beliys

This comment has been minimized.

Copy link

@beliys beliys commented Jul 12, 2020

Hi Beliys,

This command that I use to download big file from someone that shared their drive to me.

wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=1pVSPdNaEYzMkk5MKay4WtcdFtIbKMlRh' -O- | sed -rn 's/.confirm=([0-9A-Za-z]+)._/\1\n/p')&id=1pVSPdNaEYzMkk5MKay4WtcdFtIbKMlRh" -O iosxrvk9.qcow2 && rm -rf /tmp/cookies.tx

You have an incorrect regular expression that is different from the one I specified above. You use 's/.confirm=([0-9A-Za-z_]+)./\1\n/p', and in my example, 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p'.
If you specify the regular expression correctly, the file will download normally.

wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=1pVSPdNaEYzMkk5MKay4WtcdFtIbKMlRh' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=1pVSPdNaEYzMkk5MKay4WtcdFtIbKMlRh" -O iosxrvk9.qcow2 && rm -rf /tmp/cookies.txt

or

gdownload () { if [[ -n ${2} ]]; then FNAME="-O ${2}" ; fi; wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate "https://docs.google.com/uc?export=download&id=${1}" -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=${1}" $FNAME && rm -rf /tmp/cookies.txt;}; gdownload 1pVSPdNaEYzMkk5MKay4WtcdFtIbKMlRh iosxrvk9.qcow2

@f416720001

This comment has been minimized.

Copy link

@f416720001 f416720001 commented Jul 15, 2020

@beliys thanks!!

google colab works

我用這方法下載台北黑體,解決matplotlib繁體中文顯示。
I use this method to download TaipeiSansTCBeta-Regular.ttf to fixed zh-TW display problem when use matplotlib

!wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=1eGAsTN1HBpJAkeVM57_C7ccp7hbgSz3_' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=1eGAsTN1HBpJAkeVM57_C7ccp7hbgSz3_" -O TaipeiSansTCBeta-Regular.ttf && rm -rf /tmp/cookies.txt
!mv TaipeiSansTCBeta-Regular.ttf /usr/share/fonts/truetype/
@mayerja1

This comment has been minimized.

Copy link

@mayerja1 mayerja1 commented Jul 18, 2020

Hi Beliys,
This command that I use to download big file from someone that shared their drive to me.
wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=1pVSPdNaEYzMkk5MKay4WtcdFtIbKMlRh' -O- | sed -rn 's/.confirm=([0-9A-Za-z]+)._/\1\n/p')&id=1pVSPdNaEYzMkk5MKay4WtcdFtIbKMlRh" -O iosxrvk9.qcow2 && rm -rf /tmp/cookies.tx

You have an incorrect regular expression that is different from the one I specified above. You use 's/.confirm=([0-9A-Za-z_]+)./\1\n/p', and in my example, 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p'.
If you specify the regular expression correctly, the file will download normally.

wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=1pVSPdNaEYzMkk5MKay4WtcdFtIbKMlRh' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=1pVSPdNaEYzMkk5MKay4WtcdFtIbKMlRh" -O iosxrvk9.qcow2 && rm -rf /tmp/cookies.txt

or

gdownload () { if [[ -n ${2} ]]; then FNAME="-O ${2}" ; fi; wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate "https://docs.google.com/uc?export=download&id=${1}" -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=${1}" $FNAME && rm -rf /tmp/cookies.txt;}; gdownload 1pVSPdNaEYzMkk5MKay4WtcdFtIbKMlRh iosxrvk9.qcow2

Hi, this does not seem to work with large files. Smaller files (about 300 MB) download just fine, but while trying to download larger files (4.5 GB) the downloaded file is only 4 KB.

@beliys

This comment has been minimized.

Copy link

@beliys beliys commented Jul 18, 2020

Hi, this does not seem to work with large files. Smaller files (about 300 MB) download just fine, but while trying to download larger files (4.5 GB) the downloaded file is only 4 KB.

Can you send me a link to such a file? I try to help.

@mayerja1

This comment has been minimized.

Copy link

@mayerja1 mayerja1 commented Jul 18, 2020

Hi, this does not seem to work with large files. Smaller files (about 300 MB) download just fine, but while trying to download larger files (4.5 GB) the downloaded file is only 4 KB.

Can you send me a link to such a file? I try to help.

Hi, thanks for the prompt reply. Weirdly enough, now when I tried it again, it worked. I tried it a couple of times to make sure, and after a few successful tries I'm now getting this error:
HTTP request sent, awaiting response... 403 Forbidden 2020-07-18 17:38:04 ERROR 403: Forbidden.
Example of a file I need to download has id [deleted]

@beliys

This comment has been minimized.

Copy link

@beliys beliys commented Jul 18, 2020

Hi, thanks for the prompt reply. Weirdly enough, now when I tried it again, it worked. I tried it a couple of times to make sure, and after a few successful tries I'm now getting this error:
HTTP request sent, awaiting response... 403 Forbidden 2020-07-18 17:38:04 ERROR 403: Forbidden.
Example of a file I need to download has id 1S43DCZhMV6trYUYstwtZ-vmEmZogvgXF

When you try to download a file anonymously, you receive a notification https://i.imgur.com/A7RNWxR.png.
Once you fix the problem, the script should work correctly.

@yifanguan

This comment has been minimized.

Copy link

@yifanguan yifanguan commented Jul 18, 2020

Thanks! The solution is helpful!

@vikriusman

This comment has been minimized.

Copy link

@vikriusman vikriusman commented Jul 22, 2020

wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=1pVSPdNaEYzMkk5MKay4WtcdFtIbKMlRh' -O- | sed -rn 's/.confirm=([0-9A-Za-z_]+)./\1\n/p')&id=1pVSPdNaEYzMkk5MKay4WtcdFtIbKMlRh" -O iosxrvk9.qcow2 && rm -rf /tmp/cookies.txt

i use that, but this happen to me

wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=1fpZptwhfuzUGklD4RjE-kEaStTF6HQC8' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=1fpZptwhfuzUGklD4RjE-kEaStTF6HQC8" -O win-10.iso && rm -rf /tmp/cookies.txt
--2020-07-22 16:12:04--  https://docs.google.com/uc?export=download&confirm=&id=1fpZptwhfuzUGklD4RjE-kEaStTF6HQC8
Resolving docs.google.com (docs.google.com)... 74.125.24.139, 74.125.24.100, 74.125.24.102, ...
Connecting to docs.google.com (docs.google.com)|74.125.24.139|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://accounts.google.com/ServiceLogin?service=wise&passive=1209600&continue=https://docs.google.com/uc?export%3Ddownload%26confirm%26id%3D1fpZptwhfuzUGklD4RjE-kEaStTF6HQC8&followup=https://docs.google.com/uc?export%3Ddownload%26confirm%26id%3D1fpZptwhfuzUGklD4RjE-kEaStTF6HQC8&ltmpl=homepage [following]
--2020-07-22 16:12:04--  https://accounts.google.com/ServiceLogin?service=wise&passive=1209600&continue=https://docs.google.com/uc?export%3Ddownload%26confirm%26id%3D1fpZptwhfuzUGklD4RjE-kEaStTF6HQC8&followup=https://docs.google.com/uc?export%3Ddownload%26confirm%26id%3D1fpZptwhfuzUGklD4RjE-kEaStTF6HQC8&ltmpl=homepage
Resolving accounts.google.com (accounts.google.com)... 74.125.130.84, 2404:6800:4003:c04::54
Connecting to accounts.google.com (accounts.google.com)|74.125.130.84|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘win-10.iso’

win-10.iso                                                   [ <=>                                                                                                                            ]  58,28K  --.-KB/s    in 0,05s   

2020-07-22 16:12:05 (1,21 MB/s) - ‘win-10.iso’ saved [59682]
@mayerja1

This comment has been minimized.

Copy link

@mayerja1 mayerja1 commented Jul 22, 2020

it seems to me, that this method works but only sometimes and is thus very unreliable. if anyone finds a method that works 100% of the time I'd be glad to see it. I need to download a large number of large files, this method succeeds at downloading about 4 of them and then stops working

@fangruizhu

This comment has been minimized.

Copy link

@fangruizhu fangruizhu commented Jul 26, 2020

command for download any big file from google drive (for big file we need confirm download)
wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=FILEID" -O FILENAME && rm -rf /tmp/cookies.txt

Hi, thanks for the command. It works for me for the first time I downloaded a large file. But it fails for the second downloading.

--2020-07-26 13:57:59-- https://docs.google.com/uc?export=download&confirm=&id=1o586Wjya-f2ohxYf9C1RlRH-gkrzGS8t
Resolving docs.google.com (docs.google.com)... 172.217.9.206, 2607:f8b0:4004:810::200e
Connecting to docs.google.com (docs.google.com)|172.217.9.206|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘tmp.zip’

tmp.zip [ <=> ] 3.03K --.-KB/s in 0s

2020-07-26 13:58:00 (57.8 MB/s) - ‘tmp.zip’ saved [3103]

Does anyone encounter the similar problem?

@mayerja1

This comment has been minimized.

Copy link

@mayerja1 mayerja1 commented Jul 26, 2020

command for download any big file from google drive (for big file we need confirm download)
wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=FILEID" -O FILENAME && rm -rf /tmp/cookies.txt

Hi, thanks for the command. It works for me for the first time I downloaded a large file. But it fails for the second downloading.

--2020-07-26 13:57:59-- https://docs.google.com/uc?export=download&confirm=&id=1o586Wjya-f2ohxYf9C1RlRH-gkrzGS8t
Resolving docs.google.com (docs.google.com)... 172.217.9.206, 2607:f8b0:4004:810::200e
Connecting to docs.google.com (docs.google.com)|172.217.9.206|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘tmp.zip’
tmp.zip [ <=> ] 3.03K --.-KB/s in 0s
2020-07-26 13:58:00 (57.8 MB/s) - ‘tmp.zip’ saved [3103]

Does anyone encounter the similar problem?

Yes, I think everybody does. After having struggled with this for some time, I conclude, that the simplest way to solve this is to mount your google drive using https://github.com/astrada/google-drive-ocamlfuse/ and then simply copy the files.

@fangruizhu

This comment has been minimized.

Copy link

@fangruizhu fangruizhu commented Jul 27, 2020

@mayerja1 Got it! Thank u so much~~

@Manojbhat09

This comment has been minimized.

Copy link

@Manojbhat09 Manojbhat09 commented Aug 1, 2020

I found a workaround:

Follow instructions to install from here: https://github.com/mbrother2/backuptogoogle
Dont do the credentials stuff
just remove ~/.gdrive/token_v2.json after compile (Can enter any random client and secret)
and do "gdrive about"
Copy paste code on browser with the drive account, accept details
copy paste code again into terminal

Thanks it!

@Mushebeq

This comment has been minimized.

Copy link

@Mushebeq Mushebeq commented Aug 6, 2020

Why don't you guys use gdown?

@zhangyahu1

This comment has been minimized.

Copy link

@zhangyahu1 zhangyahu1 commented Sep 4, 2020

@mayerja1 Got it! Thank u so much~~

Hi, I have the same issue. How do you solve it?

@herawais

This comment has been minimized.

Copy link

@herawais herawais commented Sep 8, 2020

command for download any big file from google drive (for big file we need confirm download)
wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=FILEID" -O FILENAME && rm -rf /tmp/cookies.txt

perfect <3

@alibabadoufu

This comment has been minimized.

Copy link

@alibabadoufu alibabadoufu commented Sep 9, 2020

Hi Beliys,
This command that I use to download big file from someone that shared their drive to me.
wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=1pVSPdNaEYzMkk5MKay4WtcdFtIbKMlRh' -O- | sed -rn 's/.confirm=([0-9A-Za-z]+)._/\1\n/p')&id=1pVSPdNaEYzMkk5MKay4WtcdFtIbKMlRh" -O iosxrvk9.qcow2 && rm -rf /tmp/cookies.tx

You have an incorrect regular expression that is different from the one I specified above. You use 's/.confirm=([0-9A-Za-z_]+)./\1\n/p', and in my example, 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p'.
If you specify the regular expression correctly, the file will download normally.

wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=1pVSPdNaEYzMkk5MKay4WtcdFtIbKMlRh' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=1pVSPdNaEYzMkk5MKay4WtcdFtIbKMlRh" -O iosxrvk9.qcow2 && rm -rf /tmp/cookies.txt

or

gdownload () { if [[ -n ${2} ]]; then FNAME="-O ${2}" ; fi; wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate "https://docs.google.com/uc?export=download&id=${1}" -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=${1}" $FNAME && rm -rf /tmp/cookies.txt;}; gdownload 1pVSPdNaEYzMkk5MKay4WtcdFtIbKMlRh iosxrvk9.qcow2

This worked like a charm!

@alishdipani

This comment has been minimized.

Copy link

@alishdipani alishdipani commented Sep 20, 2020

command for download any big file from google drive (for big file we need confirm download)
wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=FILEID" -O FILENAME && rm -rf /tmp/cookies.txt

This worked for me by changing https://docs.google.com to https://drive.google.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.