Skip to content

0x007E/pyyourlstool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Version: 0.0.1 License: GPL v3

Small YOURLS Python API

This python script can be used with command line or as import from another script.

Parameter

For additional information call:

python ./tinylink.py -h
Short Expand Description
-h --help Help menu
-v --verbose Enable verbosity
-c --check Check given URL
-a --api YOURLS API URL
-k --key YOURLS API key
-u --url Short/expand URL
------- ----------- --------------------
-s --short Short given URL
-n --name Name for short URL
------- ----------- --------------------
-e --expand Expand given URL

CLI-Usage

Short a link:

# Short link without url check
python ./tinylink.py -a https://YOUR-API-URL/yourls-api.php -k API-KEY -u https://github.com/0x007e -s

# Short link with url check -c
python ./tinylink.py -a https://YOUR-API-URL/yourls-api.php -k API-KEY -u https://github.com/0x007e -s -c

# Short link with specific name -n
python ./tinylink.py -a https://YOUR-API-URL/yourls-api.php -k API-KEY -u https://github.com/0x007e -s -n linkname

# Return value is shorten URL or error message

Expand a link:

# Expand a link without url check
python ./tinylink.py -a https://YOUR-API-URL/yourls-api.php -k API-KEY -u https://YOUR-API-UR/3jd7ed -e

# Expand link with url check -c
python ./tinylink.py -a https://YOUR-API-URL/yourls-api.php -k API-KEY -u https://YOUR-API-UR/3jd7ed -e -c

# Return value is expanded URL or error message

Python usage

API: str = "https://YOUR-API-UR/"
KEY: str = "YOURKEY"

# ------------------------------------------------------------------------------

# Short link without url check
print(tinylink.short("https://github.com/0x007e"))

# Short link with url check
print(tinylink.short("https://github.com/0x007e", check=True))

# Short link with url check and specific name
print(tinylink.short("https://github.com/0x007e", check=True, keyword="MYLINK"))

# ------------------------------------------------------------------------------

# Expand link without url check
print(tinylink.expand("https://YOUR-API-UR/3jd7ed"))

# Expand link with url check
print(tinylink.expand("https://YOUR-API-UR/3jd7ed", check=True))

# ------------------------------------------------------------------------------

About

Python API to manage YOURLS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages