Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

wget not working for shared files in Google drive

Tags:

wget

I am trying to download a file from Google drive using wget command but it is not working.

wget https://drive.google.com/uc?export=download&id=0B8ZGlkqDw7hFUzViMXE4akp4NGM

It is giving me the following error.

Resolving drive.google.com (drive.google.com)... 172.217.7.238
Connecting to drive.google.com (drive.google.com)|172.217.7.238|:443... connected.
HTTP request sent, awaiting response... 400 Bad Request
2017-06-30 16:49:26 ERROR 400: Bad Request.

The file is public on web and anyone can download it directly with the provided link. So, why it is not working with wget?

like image 219
Wasi Ahmad Avatar asked Jun 30 '17 20:06

Wasi Ahmad


People also ask

How do I download a folder from Google Drive using wget?

Set the folder setting to "anyone on the internet can find and view", then you will be able to download the file with wget https://googledrive.com/host/file_id for you that is wget https://googledrive.com/host/0B-Zc9K0k9q-WdEY5a1BCUDBaejQ .

How do I download a file from Google Drive using terminal?

Remember to keep the double quotes and also include the extension in FILENAME (for example, myfile. zip ). Now, save the file and make the file executable by running this command in terminal sudo chmod +x download-gdrive.sh . Run the script using `./download-gdrive.sh".


1 Answers

Works for me with quotes:

wget "https://drive.google.com/uc?export=download&id=0B8ZGlkqDw7hFUzViMXE4akp4NGM"

P.S. Looks like the ampersand is the problem. An alternative might be to escape them separately, but quoting seems simpler and safer.

like image 54
Stefan Haustein Avatar answered Oct 13 '22 19:10

Stefan Haustein