我正在尝试获取重定向的URL,该URL在重定向到目标站点时具有JavaScript操作
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
我也尝试使用机械化,但我无法进入目标网站。