我试图在重定向到目标站点时获取具有 JavaScript 操作的重定向 URL
user_agent = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/22.0.1207.1 Safari/537.1)'
headers = { 'User-Agent' : user_agent }
values = {'name' : 'DealsIndex', 'location' : 'South Bay', 'language' : 'Perl' }
data = urllib.urlencode(values)
req = urllib2.Request("http://www.techbargains.com/jump.cfm?clkSubId=A0AC1A00319410C5900&afsrc=1&id=6860", data, headers)
res = urllib2.urlopen(req)
urlapp = res.geturl()
print urlapp
实际输出:
http://www.techbargains.com/jump.cfm?clkSubId=A0AC1A00319410C5900&afsrc=1&id=6860
预期产出
http://shop.panasonic.com/?cm_MMC=AffiliateBanner-_-SeriouslyCool-_-88x31-_-041911
我也尝试使用 mechanize,但我无法到达目标站点。