diff --git a/img/73.png b/img/73.png new file mode 100644 index 0000000..ab8a6c2 Binary files /dev/null and b/img/73.png differ diff --git a/猿人学第12题-js-base64/readme.md b/猿人学第12题-js-base64/readme.md new file mode 100644 index 0000000..30a6b55 --- /dev/null +++ b/猿人学第12题-js-base64/readme.md @@ -0,0 +1,21 @@ +## 任务:抓取这5页的数字,计算加和并提交结果 + + https://match.yuanrenxue.com/match/12 + +查看请求地址 + + https://match.yuanrenxue.com/api/match/12?page=1&m=eXVhbnJlbnh1ZTE%3D + +其中m是加密参数 + + m=eXVhbnJlbnh1ZTE%3D + +打断点调试 + +![debugger](../img/73.png) + + "m": btoa('yuanrenxue' + window.page) + +很简单,直接上python代码 + +[最后代码实现](实例12.py "js代码4") diff --git a/猿人学第12题-js-base64/实例12.py b/猿人学第12题-js-base64/实例12.py new file mode 100644 index 0000000..7b3feb2 --- /dev/null +++ b/猿人学第12题-js-base64/实例12.py @@ -0,0 +1,29 @@ +import requests +import base64 +import json + + +def get_num(): + + num = 0 + for i in range(1, 6): + con_str = 'yuanrenxue' + str(i) + ba_str = base64.b64encode(con_str.encode()).decode() + url = f"https://match.yuanrenxue.com/api/match/12?page={i}&m={ba_str}" + Headers = { + "user-agent": "yuanrenxue.project", + "cookie": "Hm_lvt_c99546cf032aaa5a679230de9a95c7db=1648698333,1648863299; " + "Hm_lvt_9bcbda9cbf86757998a2339a0437208e=1648718340,1648863297; " + "no-alert3=true; m=155; tk=7332741390523673465; sessionid=ac0xs5o2sopkirmvude3epvr8uzo8w66;" + " Hm_lpvt_9bcbda9cbf86757998a2339a0437208e=1649313675; " + "Hm_lpvt_c99546cf032aaa5a679230de9a95c7db=1649316025" + } + res = requests.get(url=url, headers=Headers) + res_dict = json.loads(res.text) + data = res_dict.get('data') + for i in data: + num += i['value'] + print(num) + + +get_num()