目标
考点:入门级js
任务:抓取这5页的数字,计算加和并提交结果
https://match.yuanrenxue.com/match/12
分析
首先看请求数据,发现可疑加密
跟进堆栈,查看代码组成
很容易看出是base64
加密yuanrenxue+page
还原
# ==================================
# --*-- coding: utf-8 --*--
# @Time : 2022/9/22 12:14
# @Author : Gorkys
# @FileName: main.py
# @Software: PyCharm
# @describe: 猿人学第十二题
# ==================================
import requests
import base64
priceCount = 0
def getPriceList(page):
global priceCount
cookies = {
'sessionid': 'x8brp5zrzu6p83y2imkeunuob3evesnv'
}
headers = {
'referer': 'https://match.yuanrenxue.com/match/12',
'user-agent': "yuanrenxue.project"
}
m = base64.b64encode(f"yuanrenxue{str(page)}".encode("utf-8"))
params = {
'page': str(page),
'm': m
}
response = requests.get('https://match.yuanrenxue.com/api/match/12', params=params, cookies=cookies,
headers=headers)
print(response.text)
data = response.json()["data"]
for i in range(len(data)):
priceCount += data[i]["value"]
for i in range(5):
getPriceList(i + 1)
print(priceCount)
# 247082