Metadata-Version: 2.4
Name: lain_shorten
Version: 1.14
Summary: URL Shortener using s.lain.la API.
Home-page: https://github.com/NecRaul/lain.la-link-shortener
Author: NecRaul
Author-email: NecRaul <necraul@kuroneko.dev>
License-Expression: LGPL-2.1-only
Project-URL: Homepage, https://github.com/NecRaul/lain.la-link-shortener
Project-URL: Documentation, https://github.com/NecRaul/lain.la-link-shortener#readme
Project-URL: Repository, https://github.com/NecRaul/lain.la-link-shortener
Project-URL: Issues, https://github.com/NecRaul/lain.la-link-shortener/issues
Keywords: python,link shortener,shortener,lain,lain.la,s.lain.la,kuroneko
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Internet :: WWW/HTTP
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests
Provides-Extra: default
Requires-Dist: pyperclip; extra == "default"
Provides-Extra: dev
Requires-Dist: flake8; extra == "dev"
Requires-Dist: isort; extra == "dev"
Requires-Dist: black; extra == "dev"
Requires-Dist: pre-commit; extra == "dev"
Requires-Dist: pyperclip; extra == "dev"
Dynamic: author
Dynamic: home-page
Dynamic: license-file

# lain.la-link-shortener

URL Shortener using `s.lain.la` API.

## Installation

### Via PyPI (Recommended)

```sh
# Basic installation
pip install lain-shorten

# With clipboard support (recommended for desktop)
pip install lain-shorten[default]
```

### From Source (Development)

```sh
git clone git@github.com:NecRaul/lain.la-link-shortener.git
cd lain-la-link-shortener
pip install -e .[dev]
```

## Usage

Simply provide a URL. The tool automatically handles protocol validation and formatting.

```sh
# Standard usage
lain-shorten https://kuroneko.dev

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

## Dependencies

* [requests](https://github.com/psf/requests): send the API request for shortening.
  * [urllib3](https://github.com/urllib3/urllib3): check validity of the URL provided.

### Optional

* [pyperclip](https://github.com/asweigart/pyperclip) - copy the shortened URL to the clipboard. (optional)

## 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

```sh
curl -X POST -d 'url=https://kuroneko.dev' https://s.lain.la
```

### The lain-shorten way

* Validation: Uses `urllib3` to ensure the URL is formatted correctly.
* Normalization: Automatically adds `https://` if missing.
* API Request: Sends the `POST` request via `requests`.
* Clipboard (Optional): If `pyperclip` is installed, the result is instantly copied to your clipboard.
