Google Drive Link Fixer
Project description
Google Drive Link Fixer
A note to developers
If you're just using glinkfix, then carry on!
If you're a developer looking to fork this repository and modify glinkfix, there are two important considerations:
-
I used poetry for dependency and publication management when developing glinkfix. Poetry is well behaved and if you're a Python developer you should check it out. It installs itself in a virtual environment, uninstalls cleanly and easily, and doesn't require
sudo
for installation. To install poetry, run this command:curl -sSL https://install.python-poetry.org | python3 -
-
I've included a file called
global-gitignore.txt
which is a copy of the.gitignore
I placed in my home directory and configured globally for all my development projects. Theglobal-gitignore.txt
file reflects my development setup (for example using tools like vscode), but yours may be different. Just cherry-pick any necessary elements fromglobal-gitignore.txt
for your own use.Details on gitignore files are available on GitHub.
Installation
The Google Drive Link Fixer is lightweight, pure Python, with no third-party dependencies.
pip3 install glinkfix
or
poetry add glinkfix
Purpose / Usage
When you share files with Google Drive the sharing link you get is only good
for accessing the content through a web browser. If you want to use a Google
Drive sharing link to embed an image in a document (e.g. in a markdown or html
file), or you want to directly download a file pointed-to by a Google Drive
sharing link using something like curl
or wget
in linux, the link needs to
be adjusted ("fixed") for these purposes.
It's not especially hard to repackage the link, but it's a pain. You have to copy the link to a text editor, carve it up manually, and reassemble it. If you've got a lot of links to deal with it starts to get very tedious. This tool is designed to remove the tedium.
Note: The animated gifs below are actually hosted on Google Drive and the "fixed" links are embedded into this README file.
Start by getting a sharing link to a file on Google Drive. Make sure it's set up for public access (Anyone with the link):
Now run glinkfix
and paste the link into the terminal. Copy the "fixed"
version and use is as required.
To display the help menu, run: glinkfix -h
usage: glinkfix [-h] (-v | -d)
This program takes a Google Drive sharing link for a file and repackages it into a link
that can be downloaded directly (e.g. using curl) or embedded in a document to be viewed
(e.g. an image in a markdown document). Note: there is a size limit of 40MB for a single
file when using Google Drive links in this manner.
optional arguments:
-h, --help show this help message and exit
-v, --view repackage the link for viewing (e.g. as an embedded link in a markdown
document).
-d, --download repackage the link for downloading (e.g. downloading using curl).
Usage Notes
- There is a 40MB size limit for a single file when using Google Drive sharing
links directly for viewing or downloading. Individual files larger than 40MB
will not render/download properly. This limit is a function of how Google
Drive works and is not related to
glinkfix
. - When creating a download link for use with
curl
make sure to usecurl
's-L
option to allow for redirects. glinkfix
supports links that use Google's resource key security feature.
Version History
- 1.0.13 (2022-11-03)
- Google made a breaking change to the format for sharing links (not that
they checked with me first 😊). This patch updates glinkfix to support the
change.
- Google made a breaking change to the format for sharing links (not that
they checked with me first 😊). This patch updates glinkfix to support the
change.
- 1.0.12 (2022-10-22)
- Regression bug fixes.
- Regression bug fixes.
- 1.0.11 (2022-10-21)
- Migrated dependency/build management to poetry.
- Migrated dependency/build management to poetry.
- 1.0.9 (2022-10-13)
- Fixed a bug when IDs or resource keys contain underscore characters (
_
) - Additional test case for bug fix.
- Moved task runner to make.
- Build local virtual environment for development.
- Code refactoring and linting.
- Fixed a bug when IDs or resource keys contain underscore characters (
- 1.0.8 (2022-07-23)
- Implemented code coverage for testing infrastructure.
- Code refactoring and linting.
- 1.0.7 (2022-07-15)
- Fixed handling of URLs with resource keys.
- Code cleanup and refactoring.
- Implemented custom exception handling.
- Implemented testing infrastructure.
- 1.0.6 (2022-01-17)
- Code cleanup.
- Code cleanup.
- 1.0.5 (2021-12-23)
- Code linting.
- Documentation cleanup.
- 1.0.4 (2021-12-19)
- Initial release
- Initial release
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for glinkfix-1.0.13-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f43d1b9c085fd5f6fc8043b07aa87242ac3e3ae328ff1a2f2b2655236629395 |
|
MD5 | feb6e254faa86fd98d64098d63f3321b |
|
BLAKE2b-256 | 64414ff3ed6e17f58ab55fa20908599f0813433593e5b6fcc2db1ab6d0326324 |