Skip to content

Instantly share code, notes, and snippets.

@pronto
pronto / headfollow
Last active April 24, 2018 17:20
find where url shorteners go
#!/usr/bin/env python3
#(works for 2.7 as well)
#todo: add support for <script>window.location='nsa.gov'<script>
import requests
import sys
def get_loc(url):
try:
h=requests.head(url).headers['location']
return h
except KeyError: