猿人学爬虫十二题典型的参数base64加密反爬

参数m加密,很明显可以看出是base64加密

使用python中base64模块加密

代码:

import requests
import base64

headers = {
    'User-Agent': "yuanrenxue.project",
}

sum = 0
for page in range(1, 6):
    m = "yuanrenxue{}".format(page)
    bytes_key = m.encode("utf-8")
    encrypted_m = base64.b64encode(bytes_key)
    params = (
        ('page', page),
        ('m', encrypted_m)
    )
    response = requests.get('http://match.yuanrenxue.com/api/match/12', headers=headers, params=params)
    data = response.json().get('data')
    for v in data:
        sum = sum + v.get("value")
print(sum)
###### sum = 247082

你可能感兴趣的:(猿人学爬虫十二题典型的参数base64加密反爬)