Bootstrap

Python爬虫后获取重定向url的两种方法

方法(一)

    # 获得重定向url
    from urllib import request
    # https://zhidao.baidu.com/question/681501874175782812.html
    url = "https://www.baidu.com/link?url=IscBx0u8h9q4Uq3ihTs_PqnoNWe7slVWAd2dowQKrnqJedvthb3zrh9JqcMJu3ZqFrbW_DKVuTnTypDbMkZx_hwCQIGFPRVWGyxRXA-65jK&wd=&eqid=f7aeecba00092ed7000000065ec62596"
    print(request.urlopen(url).geturl()
;