mirror of
https://github.com/luzhisheng/js_reverse.git
synced 2025-04-22 06:20:04 +08:00
猿人学第13题-js-cookie
This commit is contained in:
parent
bd494f7ce9
commit
51aee12008
27
猿人学第13题-js-cookie/案例13.py
Normal file
27
猿人学第13题-js-cookie/案例13.py
Normal file
@ -0,0 +1,27 @@
|
||||
import requests
|
||||
import re
|
||||
|
||||
|
||||
url = "https://match.yuanrenxue.com/match/13"
|
||||
|
||||
|
||||
def get_cookie():
|
||||
res = requests.get(url=url)
|
||||
item = re.findall(r'document.cookie=(.*);path=', res.text)[0]
|
||||
Set_Cookie = res.headers.get('Set-Cookie')
|
||||
yuanrenxue_cookie = item.replace("(", "").replace(")", "").replace("+", "").replace("'", "")
|
||||
return yuanrenxue_cookie, Set_Cookie
|
||||
|
||||
|
||||
def get_res():
|
||||
yuanrenxue_cookie, Set_Cookie = get_cookie()
|
||||
Headers = {
|
||||
"user-agent": "yuanrenxue.project",
|
||||
"cookie": Set_Cookie + ";" + yuanrenxue_cookie
|
||||
}
|
||||
print(Headers)
|
||||
res = requests.get(url=url, headers=Headers)
|
||||
print(res.text)
|
||||
|
||||
|
||||
get_res()
|
Loading…
x
Reference in New Issue
Block a user