How can I unshorten a URL?

后端 未结 9 1076
时光说笑
时光说笑 2020-11-30 05:19

I want to be able to take a shortened or non-shortened URL and return its un-shortened form. How can I make a python program to do this?

Additional Clarification:

9条回答
  •  甜味超标
    2020-11-30 05:40

    To unshort, you can use requests. This is a simple solution that works for me.

    import requests
    url = "http://foo.com"
    
    site = requests.get(url)
    print(site.url)
    

提交回复
热议问题