{"id":2041,"library":"gdown","title":"gdown: Google Drive Public File/Folder Downloader","description":"gdown is a Python package (current version 5.2.1) designed to download public files and folders from Google Drive, providing functionality that standard tools like curl or wget often lack for Google Drive links. It handles large files by skipping security notices and supports recursive downloads for folders (up to 50 files per folder). The library has an active development cycle with regular updates addressing features, enhancements, and bug fixes.","status":"active","version":"5.2.1","language":"en","source_language":"en","source_url":"https://github.com/wkentaro/gdown","tags":["google-drive","download","cli","file-management"],"install":[{"cmd":"pip install gdown","lang":"bash"}],"dependencies":[{"reason":"Used for HTTP requests to Google Drive.","package":"requests","optional":false},{"reason":"Requires Python 3.8 or higher.","package":"python","optional":false}],"imports":[{"symbol":"gdown","correct":"import gdown"}],"quickstart":{"code":"import gdown\nimport os\n\n# A public Google Drive file URL (replace with your desired file if needed)\n# This specific file is a public example from the gdown GitHub repo\nurl = \"https://drive.google.com/uc?id=1l_5RK28JRL19wpT22B-DY9We3TVXnnQQ\"\noutput_filename = \"fcn8s_from_caffe.npz\"\n\ntry:\n    gdown.download(url, output_filename, quiet=False)\n    print(f\"Successfully downloaded {output_filename}\")\nexcept Exception as e:\n    print(f\"Error downloading file: {e}\")\nfinally:\n    # Clean up the downloaded file for a repeatable quickstart\n    if os.path.exists(output_filename):\n        os.remove(output_filename)\n        print(f\"Cleaned up {output_filename}\")\n","lang":"python","description":"This quickstart demonstrates how to download a publicly accessible file from Google Drive using its URL. The `gdown.download()` function handles the process, including bypassing Google Drive's security notices for large files. The example also includes cleanup for repeatability."},"warnings":[{"fix":"Upgrade your Python environment to 3.8+ and gdown to version 5.0.0 or later.","message":"gdown dropped support for Python 2 in version 5.0.0. The library now requires Python 3.8 or higher.","severity":"breaking","affected_versions":"< 5.0.0"},{"fix":"Upgrade gdown to version 4.7.3 or later to ensure compatibility with Google Drive's User-Agent requirements.","message":"Older versions of gdown (before 4.7.3) might fail to download files due to changes in Google Drive's User-Agent handling.","severity":"gotcha","affected_versions":"< 4.7.3"},{"fix":"Remove the `--id` flag when using the CLI; simply pass the file ID or URL as an argument.","message":"The `--id` command-line option was deprecated in version 4.3.1 and removed in 5.0.0. File IDs or URLs can now be passed directly without the `--id` flag.","severity":"deprecated","affected_versions":"< 5.0.0"},{"fix":"Upgrade to gdown >= 5.2.1 to ensure that files are only moved to their final location after successful hash verification, preventing corrupted files from being retained.","message":"Prior to v5.2.1, if hash verification failed for a downloaded file, a corrupted file might have been left in the final destination. Hash verification now occurs before moving the file.","severity":"gotcha","affected_versions":"< 5.2.1"},{"fix":"Ensure the Google Drive file or folder you are trying to download has appropriate public sharing permissions.","message":"Files and folders downloaded via gdown must have their sharing permissions set to 'Anyone with the link can view' on Google Drive.","severity":"gotcha","affected_versions":"All versions"},{"fix":"For folders with more than 50 files, consider manually splitting them into smaller folders on Google Drive or compressing the folder into a single archive (e.g., a .zip file) before downloading.","message":"When downloading folders, gdown has a limitation of processing a maximum of 50 files per folder. Attempting to download larger folders may result in incomplete downloads.","severity":"gotcha","affected_versions":"All versions"},{"fix":"If using `gdown.cached_download`, update your code to use the `hash` parameter instead of `md5` and specify the desired hash algorithm (e.g., `hash='sha256:...'`).","message":"In `gdown.cached_download`, the `md5` argument was replaced with a more general `hash` argument in v5.1.0 to support various hash algorithms.","severity":"breaking","affected_versions":"< 5.1.0"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}