Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Download stuck in loop #6

Open
ojalaquellueva opened this issue Sep 28, 2018 · 2 comments
Open

Download stuck in loop #6

ojalaquellueva opened this issue Sep 28, 2018 · 2 comments

Comments

@ojalaquellueva
Copy link

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.

@circulosmeos
Copy link
Owner

Hola @ojalaquellueva ,
The problem is that the referenced file requires access permissions and so the downloaded file is the login page...
I think that although the script does not provide authentication, you can patch this by copying the cookies text data from a session in your browser, to the gdown.cookie.temp text file:
the script should load it if it exists (and is correctly formated) and the downloading should progress them.
You can check your cookies, in firefox, going to the authenticated page, then Shift+F9 (storage inspector), and under Cookies you'll have a bunch of them... They're not in the wget format... It'd take some effort to convert them to wget format... following this info at superuse.com, for example.
Let me know if you're able to use auth session cookies ;-)
May be I'll think a little about this in order to automate it somehow.

@circulosmeos
Copy link
Owner

circulosmeos commented Sep 29, 2018

I think the download of protected files can be done with the script, manually exporting browers' auth cookies. With firefox browser:

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

  2. Now firefox browser has all the needed cookies: install https://addons.mozilla.org/en-US/firefox/addon/cookies-txt/ and export them (all).

  3. open the cookies.txt 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 to a gdown.cookie.temp file in the same directory where you'll run gdown.pl. Note that gdown.cookie.temp will be deleted after each download, so retain its data in order to use it multiple times (for example make a master copy, and copy it to gdown.cookie.temp before each run).

  5. run gdown.pl with the 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants