wkentaro / gdown

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

Download a folder #201

Closed Ilyabasharov closed 1 year ago

Ilyabasharov commented 2 years ago

Provide environment information

/opt/conda/bin/python Python 3.7.10 gdown 4.5.1

What OS are you using?

Ubuntu 20.04

Describe the Bug

Retrieving folder list
Traceback (most recent call last):
  File "/opt/conda/bin/gdown", line 8, in <module>
    sys.exit(main())
  File "/opt/conda/lib/python3.7/site-packages/gdown/cli.py", line 152, in main
    remaining_ok=args.remaining_ok,
  File "/opt/conda/lib/python3.7/site-packages/gdown/download_folder.py", line 321, in download_folder
    remaining_ok=remaining_ok,
  File "/opt/conda/lib/python3.7/site-packages/gdown/download_folder.py", line 180, in download_and_parse_google_drive_link
    folder_page.text,
  File "/opt/conda/lib/python3.7/site-packages/gdown/download_folder.py", line 129, in parse_google_drive_file
    name=name,
UnboundLocalError: local variable 'name' referenced before assignment

Expected Behavior

All data should be downloaded like

Retrieving folder list
Processing file 1ZTwihF6t0jFNpwULPiLzhzEVrz9IpDL6 instance_mask.zip
Processing file 1BlSptrSE6ymRyHS2RPw-Dy2kBA7yHGm9 points.zip
Processing file 1IUVetmihs3NOAYN-PtFns5zkxsMMOcJ4 scannet_infos_0000_00.pkl
Processing file 141-rqz0uu0VLfFjqQoZJtjV5RjgtGjEE scannet_infos_test.pkl
Processing file 1Y3Tnv6ecD1EwwByza97vTsYdmyfrLQUZ scannet_infos_train.pkl
Processing file 1WkrJooM60x3HERAviH-dN2vseZNhGvvp scannet_infos_val.pkl
Processing file 12ERGYI7MLQwOZ22NvtD-Oqk2gemYVk9i seg_info.zip
Processing file 1Q7Kdk4vdVbeDe9BY0EhIH6ULxA2PMBs3 semantic_mask.zip
Retrieving folder list completed
Building directory structure
Building directory structure completed
Downloading...

If decrease the version to 4.4.0 by

pip install gdown==4.4.0

all data will be processed without errors

To Reproduce

gdown https://drive.google.com/drive/folders/1KuChuT4nsplD8APReFYkDEqW4FV6F14e -O data/ --folder
wkentaro commented 2 years ago

It looks working for me

% gdown -V
gdown 4.5.1 at /Users/wkentaro/Documents/gdown
% gdown https://drive.google.com/drive/folders/1KuChuT4nsplD8APReFYkDEqW4FV6F14e -O data/ --folder
Retrieving folder list
Processing file 1ZTwihF6t0jFNpwULPiLzhzEVrz9IpDL6 instance_mask.zip
Processing file 1BlSptrSE6ymRyHS2RPw-Dy2kBA7yHGm9 points.zip
Processing file 1IUVetmihs3NOAYN-PtFns5zkxsMMOcJ4 scannet_infos_0000_00.pkl
Processing file 141-rqz0uu0VLfFjqQoZJtjV5RjgtGjEE scannet_infos_test.pkl
Processing file 1Y3Tnv6ecD1EwwByza97vTsYdmyfrLQUZ scannet_infos_train.pkl
Processing file 1WkrJooM60x3HERAviH-dN2vseZNhGvvp scannet_infos_val.pkl
Processing file 12ERGYI7MLQwOZ22NvtD-Oqk2gemYVk9i seg_info.zip
Processing file 1Q7Kdk4vdVbeDe9BY0EhIH6ULxA2PMBs3 semantic_mask.zip
Retrieving folder list completed
Building directory structure
Building directory structure completed
Downloading...
From: https://drive.google.com/uc?id=1ZTwihF6t0jFNpwULPiLzhzEVrz9IpDL6
To: /Users/wkentaro/Documents/gdown/data/scannet/instance_mask.zip
100%|████████████████████████████████████████████████████████████| 56.1M/56.1M [00:59<00:00, 936kB/s]
Downloading...
From: https://drive.google.com/uc?id=1BlSptrSE6ymRyHS2RPw-Dy2kBA7yHGm9
To: /Users/wkentaro/Documents/gdown/data/scannet/points.zip
  1%|▋                                                          | 43.0M/3.70G [00:44<59:56, 1.02MB/s]
Ilyabasharov commented 2 years ago

@wkentaro ok, but it did not work for me. Strange

wkentaro commented 2 years ago

it could have something to do with the region/language, as HTML's title can change in different regions.

guhur commented 1 year ago

I can confirm this bug happens to me on 4.5.1 but not on 4.4.0. My file is https://drive.google.com/drive/folders/1Qx_2_ePIqf_Z6SnpPkocUiPgFeCfePQh?usp=sharing it was tested on a machine located in France.

guhur commented 1 year ago

bug fix here : https://github.com/wkentaro/gdown/pull/210

duckduckgrayduck commented 1 year ago

I can confirm the same bug on Linux Mint 20.3 in a machine in the U.S.

Ilyabasharov commented 1 year ago

@wkentaro please see this PR #210