做python爬虫的时候返回的结果,想得到对应的cookie值
"<script>document.cookie=('_')+('_')+('j')+('s')+('l')+('_')+('c')+('l')+('e')+('a')+('r')+('a')+('n')+('c')+('e')+('=')+(-~{}+'')+(1+5+'')+([2]*(3)+'')+((+[])+'')+((1<<3)+'')+((1|2)+'')+((+[])+'')+(1+1+'')+(~~{}+'')+(-~(8)+'')+('.')+(-~[7]+'')+(~~''+'')+(3+3+'')+('|')+('-')+(-~0+'')+('|')+('P')+('r')+(-~0+'')+('c')+('g')+('N')+('C')+('S')+(5+'')+('I')+('r')+('v')+('I')+('y')+('b')+('q')+('V')+('b')+(3+4+'')+(-~(3)+'')+('I')+((1|2)+'')+((1+[2]>>2)+'')+('h')+('O')+('N')+('Q')+('%')+((1+[2]>>2)+'')+('D')+(';')+('m')+('a')+('x')+('-')+('a')+('g')+('e')+('=')+(1+2+'')+([2]*(3)+'')+(~~''+'')+((+false)+'')+(';')+('p')+('a')+('t')+('h')+('=')+('/');location.href=location.pathname+location.search</script>"
尝试
def getFormJS(text):
js_code=re.findall(r'<script>(.*?)</script>',text)[0]
js=js_code.replace('document.cookie','val cookie')
ctx=execjs.compile(js)
cookie1=ctx.eval('cookie')
return cookie1
报错
2.尝试