Clishortener
A lightweight, feature-rich CLI tool to shorten links using 12+ services—with zero configuration required.
Key Features
- 🔌 14+ Services: TinyURL, Bitly, Short.io, CleanURI, and more.
- 🛠️ Custom & Self-Hosted: Full support for custom domains and YOURLS instances.
- 🎨 Colored Output: Optional colorful terminal UI using
rich. - 🛡️ Privacy Focused: Automatically strips common tracking urls.
- ⚡ Pipeline Friendly: Pass raw output directly to stdout or other scripts using bare/silent flags.
- 🕹 Plug & Play: Start shortening immediately after installation, no setup required.
Installation Options 📥
Via PyPI (recommended)
pip install clishortener[full]
This will also install optional packages. To install necessary packages only, use
pip install clishortener
From source via git
git clone https://github.com/Ruizennis/Clishortener
cd clishortener
pip install .
Quick Start
Shorten your first url ✂️
cshorten shorten https://example.com
Set your preferred service as the default 🔧
cshorten service default <servicename>
List all available services 📜
cshorten service list
Pipe data to create a pipeline 🔗
echo "https://example.com" | cshorten shorten >> links.txt
Supported Services 🌐
| Service | Identifier | API Key Required? |
|---|---|---|
| TinyURL | tinyurl-noauth / tinyurl-auth |
Optional |
| is.gd / v.gd | isgd / vgd |
No |
| da.gd | dagd |
No |
| clck.ru | clckru |
No |
| ulvis.net | ulvis |
No |
| CleanURI | cleanuri |
No |
| Bitly | bitly |
Yes |
| Cuttly | cuttly |
Yes |
| T.ly | tly |
Yes |
| Short.io | shortio |
Yes |
| Rebrandly | rebrandly |
Yes |
| Dub.co | dub |
Yes |
| Kutt.to | kutt |
Yes |
| YOURLS | yourls |
Optional |
| Custom Service | custom |
Depends on service chosen |
📜 View Provider Terms & Privacy Policies
| Provider | Legal & Policy Links |
|---|---|
| TinyURL | Privacy Policy · Terms of Service |
| is.gd | Terms & Privacy Policy |
| v.gd | Terms & Privacy Policy |
| da.gd | Privacy Policy |
| clck.ru | Privacy Policy · Terms of Use |
| ulvis.net | Service Terms |
| CleanURI | Privacy Policy · Terms of Service |
| Bitly | Privacy Policy · Terms of Service |
| Cuttly | Privacy Policy · Terms of Service |
| T.ly | Privacy Policy • Terms of Service |
| Short.io | Privacy Policy · Terms of Service |
| Rebrandly | Privacy Policy · Terms & Conditions |
| Dub.co | Privacy Policy |
| Kutt.to | Privacy Policy |
Disclaimer: These legal policy links are provided for convenience only, links may change over time and as a solo developer, I can't guarantee every link stays up to date.
Requirements 📦
| Package | Type | Purpose |
|---|---|---|
requests |
Required | Handles HTTP calls to shortening APIs |
PySocks |
Optional | Allows more types of proxying (SOCKS) |
rich |
Optional | Adds terminal colors, menus, and visual styling |
argcomplete |
Optional | Provides shell auto-completion for cshorten |
keyring / keyrings.alt |
Optional | Allows saving API keys securely for automatic authentication |
qrcode |
Optional | Allows generating qrcodes alongside the shortened url |
Global Flags
| Flag | Long Flag | Purpose |
|---|---|---|
| -b | --bare | Remove rich formatting and write to stdout without formatting |
| -h | --help | Shows help menu |
| -S | --silent | Silences all logging messages |
Shortening Flags
| Flag | Long Flag | Purpose |
|---|---|---|
| -s | --service | Allows specifying service for a command |
| -k | --key | Allows setting an api key for services that require it |
| -a | --alias | Allows setting a custom alias/slug for services that support it |
| -q | --qr | Creates a QR code along side your shortened url (Requires qrcode) |
| -t | --timeout | Allows setting custom timeout time |
| --no-strip | Disables automatic tracker parameter removal |
Additional Commands >_
| Category | Command | Description | Usage Example |
|---|---|---|---|
| Service | default |
Set default shortening service | cshorten service default <service> |
| Service | list |
List all available services | cshorten service list |
| Security | proxy edit |
Edit proxy configuration | cshorten security proxy edit |
| Security | proxy show |
Show current proxy configuration | cshorten security proxy show |
| Security | proxy reset |
Remove proxy configuration | cshorten security proxy reset |
| Security | keys set |
Add an api key for a service | cshorten security keys set bitly |
| Security | keys clear |
Clears ALL set api keys or just for specified service | cshorten security keys clear bitly |
Notes & Usage Tips 💡
- API Keys: API keys can be provided via the
-k/--keyflag for services requiring authentication or set by usingcshorten security keys set <servicename> <key>. - Service Identifiers: When specifying or setting a default service, always use the service's Identifier (e.g., dagd, tinyurl-auth) rather than its display name or URL.
⚙️ Advanced Tips & Help
- Self-Hosted & Custom Domains: Use the full URL and set the
--domainflag when usingyourlsorcustomproviders.- Custom Config: Sent in
key: valueformat.- Config Parameters:
auth_paramspecifies key requirements;url_paramsets the request payload variable (defaults to"url").- NO_COLOR: We support the NO_COLOR initiative. Add NO_COLOR=1 to os.environ to disable output styling
- FORCE_COLOR: Add FORCE_COLOR=1 to your env variables to force color for use in asciinema or vhs recordings.
- Pipes: We support piping data, when piping bare is automatically appiled ensuring no color and only url is sent allowing for more complex piping.
- Proxying: SOCKS proxies and TOR routing is fully supported if you install the required add-on for requests, simply add your socks proxy URL to the proxy list.
🛡️ Security Features
These common tracking parameters are automatically stripped when shortening.
# Standard UTM Parameters
"utm_source", "utm_medium", "utm_campaign", "utm_term",
"utm_content", "utm_id", "utm_source_platform",
# Ad Network & Click Identifiers
"gclid", "gclsrc", "fbclid", "msclkid", "ttclid",
"twclid", "dclid", "li_fat_id", "yclid",
# Platform & Social Sharing Trackers
"igshid", "s", "t", "si", "feature", "app",
"ref", "ref_src", "ref_url",
# Email & Marketing Automation (CRMs)
"mc_eid", "mc_cid", "_hsenc", "_hsmi", "mkt_tok",
"klaviyo_id", "_kx", "vero_id",
# E-Commerce & Affiliate Trackers
"tag", "ascsubtag", "ref_", "itm_source", "itm_medium",
"affiliate_id", "aff_id",
🔨 Adding Additional Services Examples
Adding httpbin as a service example
"httpbin": {
"serviceurl": "https://httpbin.org/post",
"method": "POST",
"url_param": "destination",
"slug_param": "key",
"params": {}
}
Testing httpbin example
cshorten shorten https://example.com -s httpbin -k ApiKey
No Key Service JSON Example 🔓
"0x0": {
"serviceurl": "https://0x0.st",
"method": "POST",
"multifile": true,
"url_param": "shorten",
"json_body": false,
"params": {}
},
Testing 0x0 example
cshorten shorten https://example.com -s 0x0
Authenticated API JSON Example 🔐
"shortio": {
"serviceurl": "https://api.short.io/links/public",
"auth_header": "authorization",
"url_param": "originalURL",
"method": "POST",
"json_key": "shortURL",
"json_body": true,
"params": {}
}
Planned Features 📌
- Saving api keys with Keyring & automatically loading saved api keys
- Support for making a qr code in conjunction with the short url
- Saving links created to a file (Off by default)
Additional Links & Credits 🔗
Credits to Pyshorteners made by ellisonleao for inspiring this tool
License
This project is licensed under the MIT license, see LICENSE.
Metadata
Release files for Clishortener 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| clishortener-0.3.1.tar.gz | 19.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| clishortener-0.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 36.2 kB
Release files / clishortener-0.3.1.tar.gz
| Download URL | clishortener-0.3.1.tar.gz |
|---|---|
| Size | 19.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
18cd5a5f8d4e0fb9d6c642fa7db50f29bfe020c320308543b719ad385b194945
|
|
BLAKE2b-256 checksum How to use checksums |
7f5ce315eefd7998b072752c5cbb0b811c724b6f9e65a8b3d8b32170dd503daf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.6
|
Release files / clishortener-0.3.1-py3-none-any.whl
| Download URL | clishortener-0.3.1-py3-none-any.whl |
|---|---|
| Size | 17.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d53a18473d76a69e8a740fdb2837674d8643f203fac9418979dbde5db4311ade
|
|
BLAKE2b-256 checksum How to use checksums |
e0fb6d3f31a438716b8437bc73997d5d97540a168b959516e9e037863f61d453
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.6
|
Security for Clishortener 0.3.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.