diff --git a/BasicPythonScripts/URL_Shortener/README.md b/BasicPythonScripts/URL_Shortener/README.md new file mode 100644 index 000000000..dd0be2bd0 --- /dev/null +++ b/BasicPythonScripts/URL_Shortener/README.md @@ -0,0 +1,16 @@ +

URL Shortner

+It shortens the website URL. + +## How to run the script +-Download the library using command **pip install pyshorteners** in command prompt. + +## How it works +- It takes the website URL as input. +- It shortens the given URL and returns the shortened URL. + +# Url Shortener + +Long URLs are not easy to handle so URLs should be short and sweet so that they are easy to share. + +**pyshorteners** is a Python lib to help you short and expand urls using URL Shorteners available. + \ No newline at end of file diff --git a/BasicPythonScripts/URL_Shortener/code.py b/BasicPythonScripts/URL_Shortener/code.py new file mode 100644 index 000000000..1dd3a0404 --- /dev/null +++ b/BasicPythonScripts/URL_Shortener/code.py @@ -0,0 +1,6 @@ +import pyshorteners #library in python for shortening URL +def shorten(url): + return pyshorteners.Shortener().tinyurl.short(url) ## shortening the URL + +url = input("Enter URL: ") #takes input(URL) from the user +print("Shortened URL : ", shorten(url)) #returns output \ No newline at end of file