python
import pyshorteners
long_url = "https://example.com/this-is-a-very-long-url-that-needs-to-be-shortened"
shortener = pyshorteners.Shortener()
short_url = shortener.tinyurl.short(long_url)
print(short_url)
python
import hashlib
long_url = "https://example.com/this-is-a-very-long-url-that-needs-to-be-shortened"
md5_hash = hashlib.md5(long_url.encode()).hexdigest()
short_url = md5_hash[:8]
print(short_url)
pip install pyshorteners