gdown


Namegdown JSON
Version 5.1.0 PyPI version JSON
download
home_page
SummaryGoogle Drive Public File/Folder Downloader
upload_time2024-02-03 14:22:25
maintainer
docs_urlNone
author
requires_python>=3.8
licenseMIT
keywords curl download google-drive wget
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div align="center">
  <h1>gdown</h1>
  <p><b>Google Drive Public File Downloader when Curl/Wget Fails</b></p>
  <img src="https://github.com/wkentaro/gdown/raw/main/.readme/cli.png" width="80%">
  <img src="https://github.com/wkentaro/gdown/raw/main/.readme/python.png" width="80%">
  <br>
  <br>
</div>


*Gdown* downloads a public file/folder from Google Drive.

*Gdown* provides what's curl/wget doesn't for Google Drive:
- **Skip the security notice** allowing you to download large files (curl/wget fails);
- **Recursive download** of files in a folder (maximum 50 files per folder);
- **Specify download file format** for Google Slides/Sheet/Docs like PDF/XML/CSV.


## Installation

<a href="https://pypi.org/project/gdown"><img src="https://img.shields.io/pypi/pyversions/gdown.svg"></a>
<a href="https://pypi.python.org/pypi/gdown"><img src="https://img.shields.io/pypi/v/gdown.svg"></a>

```bash
pip install gdown

# to upgrade
pip install --upgrade gdown
```


## Usage

### via Command Line

```bash
$ gdown --help
usage: gdown [-h] [-V] [-O OUTPUT] [-q] [--fuzzy] [--id] [--proxy PROXY]
             [--speed SPEED] [--no-cookies] [--no-check-certificate]
             [--continue] [--folder] [--remaining-ok]
             url_or_id
...

$ # a large file (~500MB)
$ gdown https://drive.google.com/uc?id=1l_5RK28JRL19wpT22B-DY9We3TVXnnQQ
$ md5sum fcn8s_from_caffe.npz
256c2a8235c1c65e62e48d3284fbd384

$ # same as the above but with the file ID
$ gdown 1l_5RK28JRL19wpT22B-DY9We3TVXnnQQ

$ # a small file
$ gdown https://drive.google.com/uc?id=0B9P1L--7Wd2vU3VUVlFnbTgtS2c
$ cat spam.txt
spam

$ # download with fuzzy extraction of a file ID
$ gdown --fuzzy 'https://drive.google.com/file/d/0B9P1L--7Wd2vU3VUVlFnbTgtS2c/view?usp=sharing&resourcekey=0-WWs_XOSctfaY_0-sJBKRSQ'
$ cat spam.txt
spam

$ # --fuzzy option also works with Microsoft Powerpoint files
$ gdown --fuzzy "https://docs.google.com/presentation/d/15umvZKlsJ3094HNg5S4vJsIhxcFlyTeK/edit?usp=sharing&ouid=117512221203072002113&rtpof=true&sd=true"

$ # a folder
$ gdown https://drive.google.com/drive/folders/15uNXeRBIhVvZJIhL4yTw4IsStMhUaaxl -O /tmp/folder --folder

$ # as an alternative to curl/wget
$ gdown https://httpbin.org/ip -O ip.json
$ cat ip.json
{
  "origin": "126.169.213.247"
}

$ # write stdout and pipe to extract
$ gdown https://github.com/wkentaro/gdown/archive/refs/tags/v4.0.0.tar.gz -O - --quiet | tar zxvf -
$ ls gdown-4.0.0/
gdown  github2pypi  LICENSE  MANIFEST.in  pyproject.toml  README.md  setup.cfg  setup.py  tests
```

### via Python

```python
import gdown

# a file
url = "https://drive.google.com/uc?id=1l_5RK28JRL19wpT22B-DY9We3TVXnnQQ"
output = "fcn8s_from_caffe.npz"
gdown.download(url, output)

# same as the above, but with the file ID
id = "0B9P1L--7Wd2vNm9zMTJWOGxobkU"
gdown.download(id=id, output=output)

# same as the above, and you can copy-and-paste a URL from Google Drive with fuzzy=True
url = "https://drive.google.com/file/d/0B9P1L--7Wd2vNm9zMTJWOGxobkU/view?usp=sharing"
gdown.download(url=url, output=output, fuzzy=True)

# Cached download with identity check via MD5 (or SHA1, SHA256, etc).
# Pass postprocess function e.g., extracting compressed file.
md5 = "md5:fa837a88f0c40c513d975104edf3da17"
gdown.cached_download(url, output, hash=hash, postprocess=gdown.extractall)

# a folder
url = "https://drive.google.com/drive/folders/15uNXeRBIhVvZJIhL4yTw4IsStMhUaaxl"
gdown.download_folder(url)

# same as the above, but with the folder ID
id = "15uNXeRBIhVvZJIhL4yTw4IsStMhUaaxl"
gdown.download_folder(id=id)
```


## FAQ

### I get 'Permission Denied' error.

Have you made sure you set the file permission to 'Anyone with Link'?

### I set the permission 'Anyone with Link', but still can't download.

Google restricts access to a file when the download is concentrated.
If you can still access to the file from your browser, downloading cookies file might
help. Follow this step: 1) download cookies.txt using browser extensions like
([Get cookies.txt LOCALLY](https://chromewebstore.google.com/detail/get-cookiestxt-locally/cclelndahbckbenkjhflpdbgdldlbecc));
2) mv the `cookies.txt` to `~/.cache/gdown/cookies.txt`; 3) run download again.
If you're using `gdown>=5.0.0`, it should be able to use the cookies same as your browser.


## License

MIT

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "gdown",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "curl,download,google-drive,wget",
    "author": "",
    "author_email": "Kentaro Wada <www.kentaro.wada@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/f0/c9/3dbaca0c3b134de17bbd69eeda1ff7f8eef2c64144a5e4303584bacd6177/gdown-5.1.0.tar.gz",
    "platform": null,
    "description": "<div align=\"center\">\n  <h1>gdown</h1>\n  <p><b>Google Drive Public File Downloader when Curl/Wget Fails</b></p>\n  <img src=\"https://github.com/wkentaro/gdown/raw/main/.readme/cli.png\" width=\"80%\">\n  <img src=\"https://github.com/wkentaro/gdown/raw/main/.readme/python.png\" width=\"80%\">\n  <br>\n  <br>\n</div>\n\n\n*Gdown* downloads a public file/folder from Google Drive.\n\n*Gdown* provides what's curl/wget doesn't for Google Drive:\n- **Skip the security notice** allowing you to download large files (curl/wget fails);\n- **Recursive download** of files in a folder (maximum 50 files per folder);\n- **Specify download file format** for Google Slides/Sheet/Docs like PDF/XML/CSV.\n\n\n## Installation\n\n<a href=\"https://pypi.org/project/gdown\"><img src=\"https://img.shields.io/pypi/pyversions/gdown.svg\"></a>\n<a href=\"https://pypi.python.org/pypi/gdown\"><img src=\"https://img.shields.io/pypi/v/gdown.svg\"></a>\n\n```bash\npip install gdown\n\n# to upgrade\npip install --upgrade gdown\n```\n\n\n## Usage\n\n### via Command Line\n\n```bash\n$ gdown --help\nusage: gdown [-h] [-V] [-O OUTPUT] [-q] [--fuzzy] [--id] [--proxy PROXY]\n             [--speed SPEED] [--no-cookies] [--no-check-certificate]\n             [--continue] [--folder] [--remaining-ok]\n             url_or_id\n...\n\n$ # a large file (~500MB)\n$ gdown https://drive.google.com/uc?id=1l_5RK28JRL19wpT22B-DY9We3TVXnnQQ\n$ md5sum fcn8s_from_caffe.npz\n256c2a8235c1c65e62e48d3284fbd384\n\n$ # same as the above but with the file ID\n$ gdown 1l_5RK28JRL19wpT22B-DY9We3TVXnnQQ\n\n$ # a small file\n$ gdown https://drive.google.com/uc?id=0B9P1L--7Wd2vU3VUVlFnbTgtS2c\n$ cat spam.txt\nspam\n\n$ # download with fuzzy extraction of a file ID\n$ gdown --fuzzy 'https://drive.google.com/file/d/0B9P1L--7Wd2vU3VUVlFnbTgtS2c/view?usp=sharing&resourcekey=0-WWs_XOSctfaY_0-sJBKRSQ'\n$ cat spam.txt\nspam\n\n$ # --fuzzy option also works with Microsoft Powerpoint files\n$ gdown --fuzzy \"https://docs.google.com/presentation/d/15umvZKlsJ3094HNg5S4vJsIhxcFlyTeK/edit?usp=sharing&ouid=117512221203072002113&rtpof=true&sd=true\"\n\n$ # a folder\n$ gdown https://drive.google.com/drive/folders/15uNXeRBIhVvZJIhL4yTw4IsStMhUaaxl -O /tmp/folder --folder\n\n$ # as an alternative to curl/wget\n$ gdown https://httpbin.org/ip -O ip.json\n$ cat ip.json\n{\n  \"origin\": \"126.169.213.247\"\n}\n\n$ # write stdout and pipe to extract\n$ gdown https://github.com/wkentaro/gdown/archive/refs/tags/v4.0.0.tar.gz -O - --quiet | tar zxvf -\n$ ls gdown-4.0.0/\ngdown  github2pypi  LICENSE  MANIFEST.in  pyproject.toml  README.md  setup.cfg  setup.py  tests\n```\n\n### via Python\n\n```python\nimport gdown\n\n# a file\nurl = \"https://drive.google.com/uc?id=1l_5RK28JRL19wpT22B-DY9We3TVXnnQQ\"\noutput = \"fcn8s_from_caffe.npz\"\ngdown.download(url, output)\n\n# same as the above, but with the file ID\nid = \"0B9P1L--7Wd2vNm9zMTJWOGxobkU\"\ngdown.download(id=id, output=output)\n\n# same as the above, and you can copy-and-paste a URL from Google Drive with fuzzy=True\nurl = \"https://drive.google.com/file/d/0B9P1L--7Wd2vNm9zMTJWOGxobkU/view?usp=sharing\"\ngdown.download(url=url, output=output, fuzzy=True)\n\n# Cached download with identity check via MD5 (or SHA1, SHA256, etc).\n# Pass postprocess function e.g., extracting compressed file.\nmd5 = \"md5:fa837a88f0c40c513d975104edf3da17\"\ngdown.cached_download(url, output, hash=hash, postprocess=gdown.extractall)\n\n# a folder\nurl = \"https://drive.google.com/drive/folders/15uNXeRBIhVvZJIhL4yTw4IsStMhUaaxl\"\ngdown.download_folder(url)\n\n# same as the above, but with the folder ID\nid = \"15uNXeRBIhVvZJIhL4yTw4IsStMhUaaxl\"\ngdown.download_folder(id=id)\n```\n\n\n## FAQ\n\n### I get 'Permission Denied' error.\n\nHave you made sure you set the file permission to 'Anyone with Link'?\n\n### I set the permission 'Anyone with Link', but still can't download.\n\nGoogle restricts access to a file when the download is concentrated.\nIf you can still access to the file from your browser, downloading cookies file might\nhelp. Follow this step: 1) download cookies.txt using browser extensions like\n([Get cookies.txt LOCALLY](https://chromewebstore.google.com/detail/get-cookiestxt-locally/cclelndahbckbenkjhflpdbgdldlbecc));\n2) mv the `cookies.txt` to `~/.cache/gdown/cookies.txt`; 3) run download again.\nIf you're using `gdown>=5.0.0`, it should be able to use the cookies same as your browser.\n\n\n## License\n\nMIT\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Google Drive Public File/Folder Downloader",
    "version": "5.1.0",
    "project_urls": {
        "Homepage": "https://github.com/wkentaro/gdown"
    },
    "split_keywords": [
        "curl",
        "download",
        "google-drive",
        "wget"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cb56f4845ed78723a4eb8eb22bcfcb46e1157a462c78c0a5ed318c68c98f9a79",
                "md5": "564c6922c0ef29fb486a17fc7afcc5bc",
                "sha256": "421530fd238fa15d41ba43219a79fdc28efe8ac11022173abad333701b77de2c"
            },
            "downloads": -1,
            "filename": "gdown-5.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "564c6922c0ef29fb486a17fc7afcc5bc",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 17769,
            "upload_time": "2024-02-03T14:22:22",
            "upload_time_iso_8601": "2024-02-03T14:22:22.346897Z",
            "url": "https://files.pythonhosted.org/packages/cb/56/f4845ed78723a4eb8eb22bcfcb46e1157a462c78c0a5ed318c68c98f9a79/gdown-5.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f0c93dbaca0c3b134de17bbd69eeda1ff7f8eef2c64144a5e4303584bacd6177",
                "md5": "6891109d0e426e9661d525ea2f805e3b",
                "sha256": "550a72dc5ca2819fe4bcc15d80d05d7c98c0b90e57256254b77d0256b9df4683"
            },
            "downloads": -1,
            "filename": "gdown-5.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "6891109d0e426e9661d525ea2f805e3b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 283961,
            "upload_time": "2024-02-03T14:22:25",
            "upload_time_iso_8601": "2024-02-03T14:22:25.475874Z",
            "url": "https://files.pythonhosted.org/packages/f0/c9/3dbaca0c3b134de17bbd69eeda1ff7f8eef2c64144a5e4303584bacd6177/gdown-5.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-03 14:22:25",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "wkentaro",
    "github_project": "gdown",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "gdown"
}
        
Elapsed time: 0.17747s