wkentaro / gdown

Google Drive Public File Downloader when Curl/Wget Fails
MIT License
4.16k stars 345 forks source link

Permission denied although I have set to "anyone with link" #146

Closed thibaulttabarin closed 2 years ago

thibaulttabarin commented 2 years ago

I have 355 MB file on google drive I have download before with gdown and it worked (around Nov 2021) Today 14 Feb 2022, when I tried again it didn't worked.

I use : gdown --id Error: Access denied with the following error:

    Cannot retrieve the public link of the file. You may need to change
    the permission to 'Anyone with the link', or have had many accesses. 

You may still be able to access the file from the browser:

     https://drive.google.com/uc?id=1QWzmHdF1L_3hbjM85nOjfdHsm-iqQptG 

I am the owner of the file on Google drive, I checked again for the status of the link (set to "Anyonae with the link")

I have asked a colleague to download the file and it worked for him using the same command : gdown --id I uninstall and reinstall gdown Still doesn't work Any idea?

thibaulttabarin commented 2 years ago

Solved! after restarting my terminal. It worked! I have no idea why. If someone knows?

p208p2002 commented 2 years ago

having the same question, but still stuck. it might be google's problem

d-01 commented 2 years ago

Stopped working for large files (197.4MB) about a day ago. Looks like google made some breaking changes recently.

Update: Strange behavior: after restarting the session (Colab notebook) the first big file is downloaded successfully, the second download (same or another big file) fails with the error. Small files are not affected.

wkentaro commented 2 years ago

FYI: it probably the same problem as https://github.com/wkentaro/gdown/issues/43

p208p2002 commented 2 years ago

so strange, same code pass on gh-action but failed on my own machine. try add option --no-cookies, that works for me.

d-01 commented 2 years ago

Google Drive link (Get link → Anyone with the link): https://drive.google.com/file/d/1AHn99gSXRWjPHixmni1Z5fAQ9Jf3xjrt/view?usp=sharing

> gdown --id 1AHn99gSXRWjPHixmni1Z5fAQ9Jf3xjrt

Access denied with the following error:

    Cannot retrieve the public link of the file. You may need to change
    the permission to 'Anyone with the link', or have had many accesses. 

You may still be able to access the file from the browser:

     https://drive.google.com/uc?id=1AHn99gSXRWjPHixmni1Z5fAQ9Jf3xjrt
  1. Same result with --no-cookies.
  2. Changing permissions (restricted, viewer, editor) didn't help.
  3. Small files work OK.

When the "Download anyway" button is pressed, a direct link is generated:

firefox_2022-02-16_041657+03

This link works only in the same browser.

zagzam commented 2 years ago

Same issue here.

robmoore commented 2 years ago

The page that is displayed (see comment two up for an example) contains a link in the source that can be used to download the item without being forced to click the button. The link has a query parameter of confirm=t. I'm able to download a file using curl like so:

curl -L -s -o data/my-file.h5 'https://drive.google.com/uc?id=my-file-id-here&confirm=t

ZDisket commented 2 years ago

@robmoore This works for me if I modify it slightly curl -L -o 'FILENAME.h5' 'https://drive.google.com/u/0/uc?id=MY_ID_HERE&export=download&confirm=t' (I also removed the -s to ensure it is downloading the correct file)

VKarpick commented 2 years ago

In the last week, I started having this problem with a file that I hadn't previously had any trouble with. This is the fix I found:

gdown.download(
    f"https://drive.google.com/uc?export=download&confirm=pbef&id={file_id}",
    output
)
Edoardoba commented 2 years ago

In the last week, I started having this problem with a file that I hadn't previously had any trouble with. This is the fix I found:

gdown.download(
    f"https://drive.google.com/uc?export=download&confirm=pbef&id={file_id}",
    output
)

This solution worked for me. Huge thanks

wkentaro commented 2 years ago

@VKarpick It also worked in my environment! Thank you so much for finding the solution!! https://github.com/wkentaro/gdown/pull/147 will include your solution. Hope this fixes all the problems related to Permission Error after many accesses.

wkentaro commented 2 years ago

Gdown v4.3.0 is out! https://github.com/wkentaro/gdown/releases/tag/v4.3.0 Hope it fixes this issue. (Please request reopening if not)

FYI, you can upgrade gdown by:

pip install --upgrade --no-cache-dir gdown
abdelmalek13 commented 2 years ago

In the last week, I started having this problem with a file that I hadn't previously had any trouble with. This is the fix I found:

gdown.download(
    f"https://drive.google.com/uc?export=download&confirm=pbef&id={file_id}",
    output
)

The new version still produced the same error, but this comment solve it. Thanks :pray:

wkentaro commented 2 years ago

@abdelmalek13 Can you possibly share the file id (privately via email)? I need to know why is that.

reisner commented 2 years ago

@wkentaro Does it have something to do with open vs uc links? The first snippet below works (using the open link) and the second doesn't (using the uc link):

# Works:
>>> for i in range(10):
...     gdown.download('https://drive.google.com/open?id=1EC5XAM-maBPsbMTfvpBs_NFo3UC_qFMy', 'temp.pdf', use_cookies = False, quiet = True)
... 
'temp.pdf'
'temp.pdf'
'temp.pdf'
'temp.pdf'
'temp.pdf'
'temp.pdf'
'temp.pdf'
'temp.pdf'
'temp.pdf'
'temp.pdf'
# Fails
>>> for i in range(10):
...     gdown.download('https://drive.google.com/uc?id=1EC5XAM-maBPsbMTfvpBs_NFo3UC_qFMy', 'temp.pdf', use_cookies = False, quiet = True)
... 
Access denied with the following error:

        Cannot retrieve the public link of the file. You may need to change
        the permission to 'Anyone with the link', or have had many accesses. 

You may still be able to access the file from the browser:

         https://drive.google.com/uc?id=1EC5XAM-maBPsbMTfvpBs_NFo3UC_qFMy 
abdelmalek13 commented 2 years ago

@abdelmalek13 Can you possibly share the file id (privately via email)? I need to know why is that.

I'm too sorry :pray: @wkentaro it's a sensitive document that belonged to a customer I can't share this file with you, I'll try to reproduce the error with another dummy file

amituofo1996 commented 2 years ago

Solved! after restarting my terminal. It worked! I have no idea why. If someone knows?

Thanks a lot

maheshmestry commented 1 year ago

Solved by upgrading python version 2.7 to latest along with pip3 version

AnirudhJayant06 commented 1 year ago

In google colab try this, it solved my issue

!pip install --upgrade --no-cache-dir gdown

Q8sh2ing commented 1 year ago

Gdown v4.3.0 is out! https://github.com/wkentaro/gdown/releases/tag/v4.3.0 Hope it fixes this issue. (Please request reopening if not)

FYI, you can upgrade gdown by:

pip install --upgrade --no-cache-dir gdown

thanks, mine works after updating. Hope it doesn't crash again

Sanyam-oss commented 1 year ago

In the last week, I started having this problem with a file that I hadn't previously had any trouble with. This is the fix I found:

gdown.download(
    f"https://drive.google.com/uc?export=download&confirm=pbef&id={file_id}",
    output
)

Huge Thanks ! Saviour

Bastukorv commented 7 months ago

Hello! I understand if this is a beginners question, but nonetheles: I get the above error msg:

"Access denied with the following error:

Cannot retrieve the public link of the file. You may need to change
the permission to 'Anyone with the link', or have had many accesses. 

You may still be able to access the file from the browser:"

And I have tried reading through the fixes for this problem. However, Im not sure how to try them since I just use GitHub through the web browser to do RVC (change audio files through pre-trained voice models). All I do is run a session with the small play-button and I dont know how to solve the problem that I can no longer add new AI-voice models.

Is this problem solvable without using external software (many are refering to updating python and gdown) Thanks for your help! :)