GithubHelp home page GithubHelp logo

circulosmeos / gdown.pl Goto Github PK

View Code? Open in Web Editor NEW
927.0 20.0 200.0 38 KB

Google Drive direct download of big files

Home Page: https://circulosmeos.wordpress.com/2014/04/12/google-drive-direct-download-of-big-files

License: GNU General Public License v3.0

Perl 89.55% Dockerfile 1.08% Singularity 9.37%
perl-scripts google-drive wget gdrive dockerfile

gdown.pl's Introduction

gdown.pl

Google Drive direct download of big files

Requirements

wget and Perl must be in the PATH.
Windows and linux compatible.

Usage

Use Google Drive shareable links, viewable by anyone:

$ ./gdown.pl 'gdrive file url' ['desired file name']   

Example

For example, to download this video from my axolotl project, just copy the url, and give a file name if desired:

$ ./gdown.pl https://drive.google.com/file/d/0B1L_hFrWJfRhLUJZdXdSdTdfSWs/edit axolotl.mp4   

Resuming a download

As long as a file name is indicated as second parameter, gdown.pl will try to resume the partially downloaded file if an incomplete file with that name already exists. Please note that for this to work, wget must correctly provide --spider with --server-response (-S). wget v1.17 at least is advised.

Download protected files

Download of protected files can be done manually exporting browers' auth cookies. With firefox or chrome browsers:

  1. authenticate in google drive or get access to the file download (and stop there, as you want to download it with gdown.pl)

  2. Now the browser has all the needed cookies: install cookies-txt for firefox and export them (all), or editthiscookie for chrome (in this case, change in Options the format of exportation to Netscape HTTP Cookie File)

  3. if using firefox and "cookies-txt" addon, open the cookies.txt exported file and remove the string "#HttpOnly_" from all lines. With vim this suffices: ":%s/^#HttpOnly_//" (and ":wq" to exit). If you're an experienced txt master, maintain only "^[^\s]*.google.com" lines, and remove from them the string "#HttpOnly_".

  4. copy the (cookies.txt) modified content (if using firefox and cookies-txt) or copy directly from the clipboard (if using chrome and editthiscookie addon) to gdown.cookie.temp file in the same directory where you'll run gdown.pl.

  5. run gdown.pl with your protected link

  6. It should now download the file, and any other file which needs access permissions with the account used in (1). But only until that session finishes.

Version

This version is v2.3.

Warning

Please, note that v1.2 (available between days 12 to 31 of Jan/2019) should not be used, as it contains a bug that could result in unusable downloaded files. Proceed to overwrite with v1.4 in case you have it.

Docker

A simple Docker file is provided, to build a simple Docker image with gdown.pl.
This has been used for pre-pulling data from a Google Drive to Kubernetes persistent volumes.
Thanks @anton-khodak

Singularity

An example Singularity file is provided.
Build the container: sudo singularity build (imagename) Singularity

Run the container: singularity run (imagename) (gdown.pl args)

Thanks to @ttbrunner

License

Distributed under GPL 3

Disclaimer

This software is provided "as is", without warranty of any kind, express or implied.

More info

https://circulosmeos.wordpress.com/2014/04/12/google-drive-direct-download-of-big-files

Contact

by circulosmeos

gdown.pl's People

Contributors

circulosmeos avatar njzjz avatar tpenguinltg avatar ttbrunner avatar wardevour avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gdown.pl's Issues

the process can't stop

when running ./gdown, if I input ctrl+c , the downloading process can't stop, I must kill process, is there any other solution?

Run with php file in cPanel

In cPanel's file I have cgi-bin folder and I put gdown.pl in that folder.
I've tried to run gdown.pl with below mentioned php file in my root directory:
<?php exec('cgi-bin/gdown.pl https://drive.google.com/file/d/0B1L_hFrWJfRhLUJZdXdSdTdfSWs/edit axolotl.mp4'); ?>
But it is showing blank page.
Any Idea?

I am receiving a webpage instead of the file

I've tried to download a zip file and I got this (only the first part of the zip file):

alela@intranet:~/newbackup$ head cron_en_server_ostel.zip

<title>Descubre Google Drive: un lugar para todos tus archivos</title> <style> the file continues...

403 Forbidden

I'm getting a 403 error when downloading. The file is set so anyone with the link can view. It appears to start downloading, but during the download gets a 403 error.

--2022-05-04 19:07:28--  https://docs.google.com/uc?id=1Lj6xMvQcF9dSCxVQS2nia4SiEoPXbtCv&export=download
Resolving docs.google.com (docs.google.com)... 142.250.148.100, 142.250.148.102, 142.250.148.139, ...
Connecting to docs.google.com (docs.google.com)|142.250.148.100|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘gdown.20220504190728.779284617238776’

     0K                                     28.8M=0s

2022-05-04 19:07:29 (28.8 MB/s) - ‘gdown.20220504190728.779284617238776’ saved [2230]

--2022-05-04 19:07:29--  https://docs.google.com/uc?id=1Lj6xMvQcF9dSCxVQS2nia4SiEoPXbtCv&export=download
Resolving docs.google.com (docs.google.com)... 142.250.148.100, 142.250.148.138, 142.250.148.113, ...
Connecting to docs.google.com (docs.google.com)|142.250.148.100|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘gdown.20220504190728.779284617238776’

     0K                                     24.7M=0s

2022-05-04 19:07:29 (24.7 MB/s) - ‘gdown.20220504190728.779284617238776’ saved [2230]

--2022-05-04 19:07:29--  https://docs.google.com/uc?id=1Lj6xMvQcF9dSCxVQS2nia4SiEoPXbtCv&export=download
Resolving docs.google.com (docs.google.com)... 142.250.148.100, 142.250.148.113, 142.250.148.138, ...
Connecting to docs.google.com (docs.google.com)|142.250.148.100|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘gdown.20220504190728.779284617238776’

     0K                                     20.6M=0s

2022-05-04 19:07:29 (20.6 MB/s) - ‘gdown.20220504190728.779284617238776’ saved [2230]

--2022-05-04 19:07:29--  https://docs.google.com/uc?id=1Lj6xMvQcF9dSCxVQS2nia4SiEoPXbtCv&export=download
Resolving docs.google.com (docs.google.com)... 142.250.148.102, 142.250.148.139, 142.250.148.138, ...
Connecting to docs.google.com (docs.google.com)|142.250.148.102|:443... connected.
HTTP request sent, awaiting response... 403 Forbidden
2022-05-04 19:07:35 ERROR 403: Forbidden.

Couldn't download the file :-(

Script fails after installing VirtualBox Guest Additions

Awesome script, by the way. But I'm running into an issue... It works fine on a new installation of Ubuntu in a virtual machine in VirtualBox. But as soon as I install VirtualBox Guest Additions on Ubuntu, I start getting this from the script instead:
./gdown.pl 'https://drive.google.com/open?id=17wfbfZuL90z4Z_FZPHK7l8FecepZ3dyP' 'LINUX.X64_180000_db_home.zip':
Capture
And I get the same result with v2.0.

I have yet to figure out what difference VirtualBox Guest Additions could be making, or how to continue using the script. Any ideas?

Thanks!

Did not continue to download from the wget-log file.

I am trying to download a very large 5 gig file. After all day downloading, I went to bed. In the middle of the night, the internet shut down. This morning I started back up to continue the download. But it is starting a new download. I see that the numbers in the wget-log are not the same as what is in the terminal window. Is there a way to just type in the numbers to continue the download from yesterday?

v1.2 doesn't work around the Virus Scan question of Gdrive it seems

I have used v1.1 with success (thank you!), and that works still (just tested).

Now using v1.2 downloads a large .tar.gz file with the right size, but includes the HTML code at the beginning of the file with GDrive asking if you're okay with it that they can't viruscheck this file for its size.

The size is correct, the file content isn't.

If you need more information or testing, I'm at your service.

Download stuck in loop

The output loops endlessly through the following:

--2018-09-28 11:56:42--  https://drive.google.com/uc?export=download&confirm=Jggw&id=1iNQ3g1fNrPC5sy1d7mtZ-SQUZ8hKgePG
Resolving drive.google.com (drive.google.com)... 216.58.219.14, 2607:f8b0:4007:806::200e
Connecting to drive.google.com (drive.google.com)|216.58.219.14|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://accounts.google.com/ServiceLogin?service=wise&passive=1209600&continue=https://drive.google.com/uc?export%3Ddownload%26confirm%3DJggw%26id%3D1iNQ3g1fNrPC5sy1d7mtZ-SQUZ8hKgePG&followup=https://drive.google.com/uc?export%3Ddownload%26confirm%3DJggw%26id%3D1iNQ3g1fNrPC5sy1d7mtZ-SQUZ8hKgePG&ltmpl=drive [following]
--2018-09-28 11:56:42--  https://accounts.google.com/ServiceLogin?service=wise&passive=1209600&continue=https://drive.google.com/uc?export%3Ddownload%26confirm%3DJggw%26id%3D1iNQ3g1fNrPC5sy1d7mtZ-SQUZ8hKgePG&followup=https://drive.google.com/uc?export%3Ddownload%26confirm%3DJggw%26id%3D1iNQ3g1fNrPC5sy1d7mtZ-SQUZ8hKgePG&ltmpl=drive
Resolving accounts.google.com (accounts.google.com)... 216.58.219.13, 2607:f8b0:4007:806::200d
Connecting to accounts.google.com (accounts.google.com)|216.58.219.13|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘centroids_table.zip’

    [ <=>                                                                                         ] 57,015      --.-K/s   in 0.006s  

...until I cancel. The result is 0 bytes of the target file (here, "centroids_table.zip") and a small cookie file, "gdown.cookie.temp"

This is a new issue. Your great script has worked flawlessly until recently.

ERROR 403: Forbidden

image
Hi! Your code is very useful until this happens, it seems I do not have permission to access this google drive file.
But I can download this file from my Chrome browser directly.

how to resume download

I have a 256G dataset need to be download from google drive, the connection will break, so can this tool resume download?
thanks for help!!!

How can It use with web browser

assume a domain name like- abcdef.com and it has cgi-bin folder.
If I want to use this Perl for downloading a big file of google drive then what have to do?

Couldn't download the file

./gdown.pl https://docs.google.com/spreadsheets/d/1Cjsryejgzo12Bn29BDiInOrGZWvg/edit quameserver.xlsx

--2019-04-22 16:34:41--  https://docs.google.com/spreadsheets/d/1Cjsryejgzo12Bn29BDiInOrGZWvg/edit
Resolving docs.google.com (docs.google.com)... 172.217.24.46, 2404:6800:4005:810::200e
Connecting to docs.google.com (docs.google.com)|172.217.24.46|: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/spreadsheets/d/1Cjsryejgzo12Bn29BDiInOrGZWvg/edit&followup=https://docs.google.com/spreadsheets/d/1Cjsryejgzo12Bn29BDiInOrGZWvg/edit&ltmpl=sheets [following]
--2019-04-22 16:34:42--  https://accounts.google.com/ServiceLogin?service=wise&passive=1209600&continue=https://docs.google.com/spreadsheets/d/1Cjsryejgzo12Bn29BDiInOrGZWvg/edit&followup=https://docs.google.com/spreadsheets/d/1Cjsryejgzo12Bn29BDiInOrGZWvg/edit&ltmpl=sheets
Resolving accounts.google.com (accounts.google.com)... 216.58.200.77, 2404:6800:4005:80f::200d
Connecting to accounts.google.com (accounts.google.com)|216.58.200.77|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘quantaserver.xlsx’

     0K                                     1010K=0,06s

2019-04-22 16:34:42 (1010 KB/s) - ‘quameserver.xlsx’ saved [57436]

Couldn't download the file :-(

gdown.pl does not resume instead re-downloads all over again

When I try $ ./gdown.pl https://drive.google.com/file/d/0B1L_hFrWJfRhLUJZdXdSdTdfSWs/edit axolotl.mp4 after it downloaded the file, it starts downloading the same file all over again.

Seems like resume operation does not work on my end, what may be the reason? It keeps generating files as gdown.2020... with different name.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.