Hey Coder are you eager to learn to code "URL Shortener" using python...
✅Problem Statement:
Mr. John is working on presentation & he need to include a very long link in his presentation.
We need to shorten the link to make the presentation super cool & impressive.
Let's create a URL shortener!!!
✅Concepts Coverd in this Post :
- pyshorteners library
- using Shortener()
- using tinyurl.short()
- using input()
- using print()
📑Let's Code :
Step 1: Open VS code and create a python file name as URLshortener.py
Step 2: Now we will download the pyshorteners library using the terminal.
Click on terminal above and type command as pip install pyshorteners.
After successfully installing you will see output as above.
Step 3:
First we will import the pyshorteners library file.
Now we will take the input URL using input() function and store this in the link variable.
We will assign the pyshorteners.Shortener() function to the shortener variable, and we can use it as many times as possible.
Now we pass input URL to tinyurl.short function as a parameter & then store it into a short_link variable.
Finally we will print shorter URL using print() function .
Check below photo for better understanding.
🔎Now let's try is this code is working or not
We will take my own youtube channel url link, let's see....😊😊😊
We will copy and past the link and will see output..
To check does short link work or not 💥💥
Please click on link and subscribe to channel :- https://tinyurl.com/2fqu6orm
It was fun to code with you guys, please check below for more blog.😊😊