Created
April 8, 2024 14:19
-
-
Save shivamsn97/2eda3ad6edf82b116493b46341c2395e to your computer and use it in GitHub Desktop.
Free URL Shortner using Python (Thanks to emicalculator.net)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
long_url = 'https://google.com' | |
headers = { | |
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:124.0) Gecko/20100101 Firefox/124.0', | |
'Accept': '*/*', | |
'Accept-Language': 'en-US,en;q=0.5', | |
# 'Accept-Encoding': 'gzip, deflate, br', | |
'X-Requested-With': 'XMLHttpRequest', | |
'DNT': '1', | |
'Connection': 'keep-alive', | |
'Referer': 'https://emicalculator.net/', | |
'Sec-Fetch-Dest': 'empty', | |
'Sec-Fetch-Mode': 'cors', | |
'Sec-Fetch-Site': 'same-origin', | |
} | |
response = requests.get(f'https://emicalculator.net/shortly/?longURL={long_url}', headers=headers) | |
print(response.text.strip()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment