Python Tutorials

URL Shortener Using Python

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

KSR

Hi there! I am the Founder of Cyber World Technologies. My skills include Android, Firebase, Python, PHP, and a lot more. If you have a project that you'd like me to work on, please let me know: contact@cyberworldtechnologies.co.in

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button