I want to see the last URL of the website with Python. I'm mostly using requests
and urllib2
, but everything is welcome.
The website I'm trying isn't giving Response 302
. It directly redirects using HTML or maybe PHP.
I used requests
module for this, but it seems like it doesn't count HTML PHP redirects as "Redirect".
My current code:
def get_real(domain):
red_domain = requests.get(domain, allow_redirects=True).url
return red_domain
print(get_real("some_url"))
If there is a way to achieve this, how? Thanks in advance!
Posts I checked:
- Python follow redirects and then download the page?
- Python Requests library redirect new url
- Tracking redirection of the request using request history | Packtpub
EDIT: URL I'm trying: http://001.az. It's using HTML to redirect.
HTML Code inside it:
<HTML> <HEAD><META HTTP-EQUIV=Refresh CONTENT="0; url=http://fm.vc"></HEAD> </HTML>