mirror of
https://github.com/luzhisheng/js_reverse.git
synced 2025-04-22 14:05:22 +08:00
猿人学第13题-js-cookie
This commit is contained in:
parent
0d49c28f13
commit
0575255a0c
@ -1,5 +1,6 @@
|
||||
import requests
|
||||
import re
|
||||
import json
|
||||
|
||||
|
||||
url = "https://match.yuanrenxue.com/match/13"
|
||||
@ -8,7 +9,10 @@ url_login_info = "https://match.yuanrenxue.com/api/loginInfo"
|
||||
|
||||
|
||||
def get_cookie():
|
||||
res = requests.get(url=url)
|
||||
Headers = {
|
||||
"cookie": f"sessionid=qrpjppp8jlv9y6w46ue7kewvjlnac11y;",
|
||||
}
|
||||
res = requests.get(url=url, headers=Headers)
|
||||
item = re.findall(r'document.cookie=(.*);path=', res.text)[0]
|
||||
sessionid = res.headers.get('Set-Cookie')
|
||||
yuanrenxue_cookie = item.replace("(", "").replace(")", "").replace("+", "").replace("'", "")
|
||||
@ -22,8 +26,19 @@ def get_res(num):
|
||||
"cookie": f"{sessionid}; {yuanrenxue_cookie}",
|
||||
}
|
||||
res = requests.get(url=url_page.format(num), headers=Headers)
|
||||
print(res.text)
|
||||
res_dict = json.loads(res.text)
|
||||
print(res_dict)
|
||||
data_list = res_dict.get('data')
|
||||
sum_value = 0
|
||||
for data in data_list:
|
||||
value = data.get('value')
|
||||
sum_value += value
|
||||
return sum_value
|
||||
|
||||
|
||||
all_sum_value = 0
|
||||
for i in range(1, 6):
|
||||
get_res(i)
|
||||
sum_value = get_res(i)
|
||||
all_sum_value += sum_value
|
||||
|
||||
print(all_sum_value)
|
||||
|
Loading…
x
Reference in New Issue
Block a user