From 88a36a9d42f433c4b4d0a07b7cbf89d72811f34c Mon Sep 17 00:00:00 2001 From: CodeDrinks Date: Mon, 13 Oct 2025 22:05:11 +0530 Subject: [PATCH] add simple URL shortener using pyshorteners library - Implemented a Python script to shorten URLs using the TinyURL service - Added user input handling for custom URL shortening - Display shortened link in console output - Introduced pyshorteners dependency --- URL-Shortener/UrlShortener.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 URL-Shortener/UrlShortener.py diff --git a/URL-Shortener/UrlShortener.py b/URL-Shortener/UrlShortener.py new file mode 100644 index 0000000..0a6360f --- /dev/null +++ b/URL-Shortener/UrlShortener.py @@ -0,0 +1,12 @@ +import pyshorteners +# for pyshorteners do (pip install pyshorteners) + + +def shorten_url(url): + shortener = pyshorteners.Shortener() + short_url = shortener.tinyurl.short(url) + return short_url + +if __name__ == "__main__": + url = input("Enter the URL to shorten: ") + print("Shortened URL:", shorten_url(url))