# lain.la-link-shortener
URL Shortener using s.lain.la API.
## Requirements
`requests` is used to send the API request.
`pyperclip` is used to copy the link to the clipboard.
If you want to build this on your own, you can install the requirements with
```Python
pip install -r requirements.txt
```
or install the package by running
```Python
pip install lain-shorten
```
Python's native `re` (used to check validity of the url), `argparse` (parse return request and set command argument) and `setuptools` (used to build the script) packages are also used.
## How it works
`s.lain.la` can shorten URLs using curl. I tend to forget the curl syntax and arguments quite easily, so I made a Python package to streamline things. Below is the aforementioned curl command.
```curl
curl -X POST -d 'url=https://yoururlhere.com' https://s.lain.la
```
I just wrapped it inside Python and added validation to check for links and copied the return address to clipboard for ease of use.
You can run the script with
```Python
lain-shorten <your-url-here>
```
I added support for links not starting with http/https as well.
Raw data
{
"_id": null,
"home_page": "https://github.com/NecRaul/lain.la-link-shortener",
"name": "lain-shorten",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "python,link shortener,shortener,lain,lain.la,s.lain.la",
"author": "NecRaul",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/c7/73/c1bef400e07db7bc1b32944a52344635fa0e70ef1f090f899a1de473c2f4/lain_shorten-1.10.tar.gz",
"platform": null,
"description": "# lain.la-link-shortener\n\nURL Shortener using s.lain.la API.\n\n## Requirements\n\n`requests` is used to send the API request.\n\n`pyperclip` is used to copy the link to the clipboard.\n\nIf you want to build this on your own, you can install the requirements with\n\n```Python\npip install -r requirements.txt\n```\n\nor install the package by running\n\n```Python\npip install lain-shorten\n```\n\nPython's native `re` (used to check validity of the url), `argparse` (parse return request and set command argument) and `setuptools` (used to build the script) packages are also used.\n\n## How it works\n\n`s.lain.la` can shorten URLs using curl. I tend to forget the curl syntax and arguments quite easily, so I made a Python package to streamline things. Below is the aforementioned curl command.\n\n```curl\ncurl -X POST -d 'url=https://yoururlhere.com' https://s.lain.la\n```\n\nI just wrapped it inside Python and added validation to check for links and copied the return address to clipboard for ease of use.\n\nYou can run the script with\n\n```Python\nlain-shorten <your-url-here>\n```\n\nI added support for links not starting with http/https as well.\n",
"bugtrack_url": null,
"license": "",
"summary": "URL Shortener using s.lain.la API.",
"version": "1.10",
"project_urls": {
"Documentation": "https://github.com/NecRaul/lain.la-link-shortener#readme",
"Homepage": "https://github.com/NecRaul/lain.la-link-shortener",
"Source": "https://github.com/NecRaul/lain.la-link-shortener"
},
"split_keywords": [
"python",
"link shortener",
"shortener",
"lain",
"lain.la",
"s.lain.la"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "49b2343e9e5e84a803f14d784ec1cd8ff0bff61976187d72da5d5dc3d9aeabe2",
"md5": "f10e115fbc30755edb3d1a1c6b419244",
"sha256": "d13bcc1e247f210c400c5aed841167099bbd962a1354e320624dc8e7695f8145"
},
"downloads": -1,
"filename": "lain_shorten-1.10-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f10e115fbc30755edb3d1a1c6b419244",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 12886,
"upload_time": "2024-02-24T10:18:51",
"upload_time_iso_8601": "2024-02-24T10:18:51.938263Z",
"url": "https://files.pythonhosted.org/packages/49/b2/343e9e5e84a803f14d784ec1cd8ff0bff61976187d72da5d5dc3d9aeabe2/lain_shorten-1.10-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c773c1bef400e07db7bc1b32944a52344635fa0e70ef1f090f899a1de473c2f4",
"md5": "09efbc5778e009176dda48b38f3b8c7d",
"sha256": "3ddcb741180da816761d9388d931e70a7331f0fb55e377ab0b0384891cdcebba"
},
"downloads": -1,
"filename": "lain_shorten-1.10.tar.gz",
"has_sig": false,
"md5_digest": "09efbc5778e009176dda48b38f3b8c7d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 12183,
"upload_time": "2024-02-24T10:18:53",
"upload_time_iso_8601": "2024-02-24T10:18:53.118285Z",
"url": "https://files.pythonhosted.org/packages/c7/73/c1bef400e07db7bc1b32944a52344635fa0e70ef1f090f899a1de473c2f4/lain_shorten-1.10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-24 10:18:53",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "NecRaul",
"github_project": "lain.la-link-shortener",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "pyperclip",
"specs": [
[
">=",
"1.8.2"
]
]
},
{
"name": "requests",
"specs": [
[
">=",
"2.31.0"
]
]
}
],
"lcname": "lain-shorten"
}