Skip to main content

URL Shortener using s.lain.la API.

Project description

lain.la-link-shortener

URL Shortener using s.lain.la API.

Installation

Via PyPI (Recommended)

You have the option to choose between the standard version (lain-shorten) or the desktop version (lain-shorten[clipboard]), which adds clipboard support for auto-copying links.

[!NOTE] For brevity, the examples below use the desktop version.

With pip (Basic)

pip install "lain-shorten[clipboard]"

With pipx (Isolated)

pipx install "lain-shorten[clipboard]"

With uv (Best)

The most efficient way to install or run the shortener.

# Permanent isolated installation
uv tool install "lain-shorten[clipboard]"

# Run once without installing
uvx --with "lain-shorten[clipboard]" lain-shorten <url1> <url2> <url3>

# Run in scripts or ad-hoc environments
uv run --with "lain-shorten[clipboard]" lain-shorten <url1> <url2> <url3>

From Source (Development)

# Clone the repository and navigate to it
git clone git@github.com:NecRaul/lain.la-link-shortener.git
cd lain.la-link-shortener

# Install environment and all development dependencies (mandatory and optional)
uv sync --dev

# Install pre-commit hook
uv run pre-commit install

# Optional: Run all linters and type checkers manually
uv run pre-commit run --all-files

# Run the local version
uv run lain-shorten <url1> <url2> <url3>

Usage

Simply provide a URL, and the tool will automatically handle protocol validation and formatting.

# Shorten a URL
lain-shorten https://kuroneko.dev

# Protocol-less (automatically prepends http://)
lain-shorten kuroneko.dev

Dependencies

  • requests: send the API request for shortening.

Optional

  • pyperclip: copy the shortened URL to the clipboard.

How it works

The s.lain.la service allows shortening URLs via a POST request.

This tool automates the process to avoid typing long curl strings.

The Manual Way

curl -d "url=https://kuroneko.dev" https://s.lain.la

The lain-shorten way

  • Batch Processing: Shorten multiple URLs in a single command execution, saving time over individual manual requests.
  • Validation: Uses urllib to ensure the URL is formatted correctly.
  • API Request: Sends the POST request via requests.
  • Normalization: Automatically adds http:// if missing.
  • Clipboard (Optional): If pyperclip is installed, the result is instantly copied to your clipboard.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lain_shorten-1.16.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lain_shorten-1.16-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file lain_shorten-1.16.tar.gz.

File metadata

  • Download URL: lain_shorten-1.16.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for lain_shorten-1.16.tar.gz
Algorithm Hash digest
SHA256 f1997f9147a9352d81b2cbdfa6a41d977a2cd39965dbf990b95e2f7967a94244
MD5 d54297aacad3e35c877f56019a57d89b
BLAKE2b-256 73023bd347fe4f36d00996b7d43eb18954afac97d20bb7f349cf5c0926ea0d0a

See more details on using hashes here.

File details

Details for the file lain_shorten-1.16-py3-none-any.whl.

File metadata

  • Download URL: lain_shorten-1.16-py3-none-any.whl
  • Upload date:
  • Size: 14.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for lain_shorten-1.16-py3-none-any.whl
Algorithm Hash digest
SHA256 b8f3385160f71fd14494be1b6465115a617ee61904b4cfe1cc558002d70fc3bf
MD5 15c73927b30e44d9037bd695649db45a
BLAKE2b-256 6451e699f6432147ca16bdc97eccda68cc747f56de95c797cde580d58a89168e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page