Skip to content

Instantly share code, notes, and snippets.

@shivamsn97
Created April 8, 2024 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shivamsn97/2eda3ad6edf82b116493b46341c2395e to your computer and use it in GitHub Desktop.
Save shivamsn97/2eda3ad6edf82b116493b46341c2395e to your computer and use it in GitHub Desktop.
Free URL Shortner using Python (Thanks to emicalculator.net)
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