wkentaro / gdown

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

Any alternatives on downloading large files #172

Closed qsh-zh closed 2 years ago

qsh-zh commented 2 years ago

The issue is very similar to #26

Take an example of 500mb file

gdown 1fXgBupLzThTGLLsiYCHRQJixuDsR1bSI

# error
Traceback (most recent call last):
  File "/home/qzhang419/anaconda3/bin/gdown", line 8, in <module>
    sys.exit(main())
  File "/home/qzhang419/anaconda3/lib/python3.8/site-packages/gdown/cli.py", line 145, in main
    filename = download(
  File "/home/qzhang419/anaconda3/lib/python3.8/site-packages/gdown/download.py", line 149, in download
    res = sess.get(url, headers=headers, stream=True, verify=verify)
  File "/home/qzhang419/anaconda3/lib/python3.8/site-packages/requests/sessions.py", line 555, in get
    return self.request('GET', url, **kwargs)
  File "/home/qzhang419/anaconda3/lib/python3.8/site-packages/requests/sessions.py", line 528, in request
    prep = self.prepare_request(req)
  File "/home/qzhang419/anaconda3/lib/python3.8/site-packages/requests/sessions.py", line 456, in prepare_request
    p.prepare(
  File "/home/qzhang419/anaconda3/lib/python3.8/site-packages/requests/models.py", line 316, in prepare
    self.prepare_url(url, params)
  File "/home/qzhang419/anaconda3/lib/python3.8/site-packages/requests/models.py", line 390, in prepare_url
    raise MissingSchema(error)
requests.exceptions.MissingSchema: Invalid URL '1fXgBupLzThTGLLsiYCHRQJixuDsR1bSI': No schema supplied. Perhaps you meant http://1fXgBupLzThTGLLsiYCHRQJixuDsR1bSI?

I found even on chrome, it request another confirmation too_large

Do you have any ideas or suggestions on how to fix this or alternative approaches to download a large file in the terminal?

Fannovel16 commented 2 years ago

For a large file, you need to run this command instead:

gdown https://drive.google.com/u/0/uc?id=FILE_ID_HERE&export=download&confirm=t

For example:

gdown https://drive.google.com/u/0/uc?id=1fXgBupLzThTGLLsiYCHRQJixuDsR1bSI&export=download&confirm=t
qsh-zh commented 2 years ago

@Hacker17082006 The trick is really useful! It solves my problem.

joaochenriques commented 1 year ago

The solution can be found at https://github.com/wkentaro/gdown/issues/146

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

wkentaro commented 1 year ago

The solution can be found at

https://github.com/wkentaro/gdown/issues/146

gdown.download(

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

output=filename

)

Where did the "pbef" come from?