Skip to content

Instantly share code, notes, and snippets.

@calvang
Created January 31, 2021 04:52
Show Gist options
  • Save calvang/f8c27280f6aa7a5d12c048baaf5790b8 to your computer and use it in GitHub Desktop.
Save calvang/f8c27280f6aa7a5d12c048baaf5790b8 to your computer and use it in GitHub Desktop.
Brief python3 script to recursively unmask url's that have been shortened.
from sys import argv
from requests import head
def url_unshorten(url, verbose=True):
full_url = head(url, allow_redirects=True).url
verbose and print(full_url)
return full_url
if __name__ == '__main__':
url_unshorten(argv[1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment