URL Shortener Using Python

URL Shortener Using Python

Python makes it easy to do anything in IT field.

Today we will use Python to short any URL.


We will be using “pyshorteners” module from Python.

You can install by typing "pip install pyshorteners" inside terminal.

There is nothing big to explain here, as Python makes most of the code too short and the same is here.

We are using "pyshorteners" which shorts any URL we give to the program.


Code


import pyshorteners
url = input("Enter your url")
s = pyshorteners.Shortener().tinyurl.short(url)
print("Your shorted is -->", s)

Output

Enter your url-->https://copyassignment.com/ 
Your shorted is --> http://tinyurl.com/ycnqto68

Run Python Online

Watch YouTube Video:



Also read:

  • Top 25 Pattern Programs in C++
    In this article, I will show you the Top 25 Pattern Programs in C++ that you must learn which will help you to understand the usage of nested loops. We will learn to create different geometrical shapes like Squares, triangles, Rhombus, etc. We have provided the code as well as output for all the patterns…
  • Currency Converter in C++
    In this article, we will build a simple program for Currency Converter in C++. The user will be able to convert currencies like Dollar, Euro, Pound, and Rupee. This is a console application and very simple to understand as we only use a bunch of conditionals to write the entire program. Features Users can convert…
  • SQLite | CRUD Operations in Python
    CRUD stands for Create Read Update Delete. I will show you how to perform CRUD Operations in Python. You need basic Tkinter and SQLite knowledge before you read further. This app is straightforward, when you will open this app, a GUI with 4 green colored buttons will open to perform CRUD(create read update delete) operations….
  • Number Guessing Game in C++
    In this article, we will build a simple Number Guessing Game in C++. It’s a game in which the player has to guess a secret number in a range that is generated by the computer and upon a wrong guess by the player, the game will give hints to the player to guess the correct…
  • Image background remover in Python
    Hello friends, in this article, we will learn how to create an Image background remover in Python. I will first show you a simple program and then you will see a smile GUI made using tkinter. We need to install rembg, you can install rembg using the pip command: Image background remover in Python program…


Share:
Avatar of Harry

Author: Harry

Hello friends, thanks for visiting my website. I am a Python programmer. I, with some other members, write blogs on this website based on Python and Programming. We are still in the growing phase that's why the website design is not so good and there are many other things that need to be corrected in this website but I hope all these things will happen someday. But, till then we will not stop ourselves from uploading more amazing articles. If you want to join us or have any queries, you can mail me at admin@copyassignment.com Thank you