Today We are going to learn URL Shortener Using Python

Let’s see how to use python to short any URL.

First, install “pyshorteners” by typing "pip install pyshorteners" inside terminal/cmd.

Refer to pyshorteners 1.0.1

Using “pyshorteners” module from Python

We Shorten urls using "pyshorteners" which shorts any URL we enter

With No Delay Let’s Get Started.

First Create Python File Somewhere in your Laptop.

Now Open the Python file in Editor Mode. Start writing this code.

import pyshorteners

#input to enter the link here
Url = input("Enter your Link here: ")

#code to shorten the link
shortedurl = pyshorteners.Shortener().tinyurl.short(Url)

#your shortened link is displayed here
print("Your Shortened URL is: ", shortedurl)

See Our Previous post: Download Youtube Video Using Python

Output:

Enter your Link here: https://iclick.xyz/
Your Shortened URL is: http://tinyurl.com/y3cggqy6