Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

beautifulsoup - How I can follow the redirections By Refresh meta tag With Python3

I know that requests module in python help to follow redirections, But if Target use Refresh Meta Tag for Redirect user to another page requests module can't diagnose this attempt ...

For Example https://demo.tractmanager.com/ Redirect us to another page and requests module just can diagnose port of this page https://demo.tractmanager.com:443/

I want fix this problem with Regular Expressions Module (re) But I think that isn't good choice for solve it!

what's your suggestion and prefer?

For example I coded like that

    fopen2 = open("clean url.txt", "r")
    splurl = fopen2.read().split('
')
    for i in splurl:
        getthis = requests.get(i)
        sop = BeautifulSoup(getthis.text, 'html.parser')
        if "http-equiv="refresh"" in sop:
            print('yes')
        else:
            print(getthis.url)

Thanks :)

question from:https://stackoverflow.com/questions/66051274/how-i-can-follow-the-redirections-by-refresh-meta-tag-with-python3

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...