某二手车的antipas参数加密

这里写自定义目录标题

session = requests.session()
url = 'https://www.guazi.com/bj/dazhong/'
content_html = session.get(url).content.decode('utf-8')
js = re.findall('eval\((.*)\)\;var\s*?value',content_html)[0]
js_2 = re.findall('var\s*?value.*',content_html)[0].replace('xredirect','return xredirect')
value = re.findall(r'value\s*?\=\s*?anti\S+\;', content_html)[0]
js_ = """
function aaa() {
return (%s)
}
aaa()
""" % js
js_content = execjs.compile(js_)
real_content = js_content.call('aaa')
real_js_ = real_content.replace('''if(document.cookie.indexOf(name)===-1&&navigator.cookieEnabled){alert('请修改浏览器设置,允许cookie缓存')}else{if(url==''){var url=location.href;if(location.protocol!='https:'){url='https:'+window.location.href.substring(window.location.protocol.length)}}else{if(location.protocol!='https:'){url='https:'+url}}var ulen=url.indexOf('#');if(ulen!==-1){url=url.substring(0,ulen)}location.replace(url)}}''','}').replace('document.cookie','return cookies')
js_2_ = """
    function aaa() {
    %s
    }
    """ % js_2 + real_js_
content = execjs.compile(js_2_)

l = content.call('aaa')
session.cookies['antipas'] = l.split('=')[1].split(';')[0]
print(session.get(url=url).text)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值