Skip to content

Instantly share code, notes, and snippets.

@syxolk syxolk/
Last active Feb 14, 2016

What would you like to do?
Revert the process of url shortening: Traverse and show redirects of a URL.
#!/usr/bin/env python3
import sys, requests
USER_AGENT = 'Mozilla/5.0 (Windows NT 6.3; rv:44.0) Gecko/20100101 Firefox/44.0'
if __name__ == '__main__':
if len(sys.argv) != 2:
print('Usage: <url>')
r = requests.get(sys.argv[1], headers={'User-Agent': USER_AGENT})
for h in r.history:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.