From e04c37fdbdd2ebeb2f3ed9ecd14925b6441e9664 Mon Sep 17 00:00:00 2001 From: bindaldhara Date: Thu, 14 Oct 2021 10:54:28 +0530 Subject: [PATCH] Added files --- BasicPythonScripts/URL_Shortener/README.md | 16 ++++++++++++++++ BasicPythonScripts/URL_Shortener/code.py | 6 ++++++ 2 files changed, 22 insertions(+) create mode 100644 BasicPythonScripts/URL_Shortener/README.md create mode 100644 BasicPythonScripts/URL_Shortener/code.py 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