使用python自动签到CSDN
由于csdn有签到抽奖活动,可以写一个小脚本自动签到省时省力
第一步:将下面代码中的headers和data换成你自己的headers和data,方法是打开https://i.csdn.net/#/uc/reward,打开调试工具,找到network,然后在网页上点击签到network中会出现你的headers和data数据,把它们复制下来,并转换成字典,方法为https://blog.csdn.net/a12355556/article/details/112119371,之后带着参数请求就可以了
第二步:由于是自动签到,自然是需要部署到服务器上了,详情小伙伴就自己百度python脚本部署到服务器上喽。
import requests
headers = {
'accept':'application/json, text/plain, */*',
'accept-encoding':'gzip, deflate, br',
'accept-language':'zh-CN,zh;q=0.9,en;q=0.8',
'cache-control':'no-cache',
'content-length':'241',
'content-type':'application/json;charset=UTF-8',
'cookie':'uuid_tt_dd=10_20644902740-1585309016706-911567; dc_sessioB%252522request%25255Fid%252522%25253A%252522160601203519724842915651%2525232bec4a3997715ac=1606012070; log_Id_click=514; dc_tos=qk6euh; log_Id_pv=1710',
'origin':'https://i.csdn.net',
'pragma':'no-cache',
'referer':'https://i.csdn.net/',
'sec-fetch-dest':'empty',
'sec-fetch-mode':'cors',
'sec-fetch-site':'same-site',
'user-agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36'
}
data = {
'ip':'',
'platform':'pc-my',
'product':'pc',
'user_agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36',
'username':'a12355556',
'uuid':'10_20644902740-1585309016706-911567'
}
r = requests.post("https://me.csdn.net/api/LuckyDraw_v2/signIn",headers=headers,data=data).content.decode("unicode_escape")
print(r)