B站小伙伴问题:
Python签到完整代码:
# -*- coding: utf-8 -*-
# @Author: Null119
# @Desc: { 科技玩家签到 }
# @Date: 2022/03/30 10:47
import requests,urllib3
from datetime import date
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
r=requests.session()
def qiandao(u,p):
url='https://www.kejiwanjia.com/wp-json/jwt-auth/v1/token'
pdat={
"nickname":"",
"username":u,
"password":p,
"code":"",
"img_code":"",
"invitation_code":"",
"token":"",
"smsToken":"",
"luoToken":"",
"confirmPassword":""
}
headers={
'Content-Type': 'application/x-www-form-urlencoded',
'Referer': 'https://www.kejiwanjia.com/',
'Origin': 'https://www.kejiwanjia.com',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36'
}
html=r.post(url,data=pdat,headers=headers,verify=False)
try:
token=html.json()['token']
except:
print('登录失败,请检查用户名密码是否正确!')
exit()
name=html.json()['name']
url='https://www.kejiwanjia.com/wp-json/b2/v1/getUserMission'
headers['Referer'] = 'https://www.kejiwanjia.com/mission/today'
headers['Authorization'] = 'Bearer ' + token
pdat={
'count':10,
'paged':1
}
html=r.post(url,data=pdat,headers=headers,verify=False)
try:
lastDate = html.json()['mission']['date'].split(' ')[0]
except:
lastDate =''
if lastDate==str(date.today()):
print(f'{name},{str(date.today())},今日已签过到,明天再来吧!')
else:
url='https://www.kejiwanjia.com/wp-json/b2/v1/userMission'
html=r.post(url,data='',headers=headers,verify=False)
credit=html.json()['credit']
print(f'{name},{str(date.today())},签到完成,获得积分{credit}')
if __name__ == '__main__':
user='' #你的用户名
psw='' #你的密码
qiandao(user,psw)
本站所有资源版权均属于原作者所有,这里所提供资源均只能用于参考学习使用,请在下载后24小时内删除,严禁商用。若由于商用引起版权纠纷,一切责任均由使用者承担。
【注意:本站发布资源来源于网络搜集,均有较强时效性,请在下载前注意查看文章资源发布或更新时间,距离当前时间太久的资源不建议下载,特别是安卓专区相关资源,会有大概率失效无法使用】
评论(0)