In this tutorial, we will learn how to shorten a URL using pyshorteners.
Explanation ✏
- First, we need to install pyshorteners
command: pip install pyshorteners
- Then, import pyshorteners in your program
- Add a link which you need to shorten in my case (dx4iot.hashnode.dev)
- Then finally print the URL
Code 👩💻
import pyshorteners
def shortURL():
link = "https://techcosto.com/author/dx4iot/"
print(pyshorteners.Shortener().clckru.short(link))
shortURL()
Output: clck.ru/VUyLY