Simple URL Shortener
This Python script provides a basic tool to shorten URLs using the TinyURL API.
Features:
- Shortens any valid URL.
- Uses the TinyURL service by default.
Requirements:
- Python 3
pyshorteners
library (pip install pyshorteners
)
Usage:
-
Install
pyshorteners
:pip install pyshorteners
-
Save the script as
shortener.py
(or any preferred name). -
Run the script:
python shortener.py
-
Enter the URL you want to shorten when prompted.
-
The script will print the shortened URL.
Example:
Enter the URL to shorten: https://www.example.com/long/url/path
Shortened URL: https://tinyurl.com/yourshortenedcode
Limitations:
- Relies on the TinyURL service (free tier has limitations).
- No customization for shortened URL structure.
- Basic error handling.
Further Development:
- Integrate with other URL shortening services (e.g., Bitly, Rebrandly).
- Implement custom short URL generation logic.
- Create a web interface for user interaction.
License:
This script is provided for educational purposes under the MIT License. See the LICENSE file for details.
Feel free to modify and improve this script for your specific needs.