网上教程太多了,我只又是重复造轮子,于是就不随便详细介绍了。
介绍:
只是简单的增加了一个循环,可以同时为多人来进行签到和打卡。同时采用题库形式来回答问题,减少了请求次数。
自动签到已经失效,原因wps升级,调用了微信的接口验证导致失效。但邀请人仍有效,打卡一天能顶十几天
使用教程:
1.需要获取WPS的wps_sid(对应下面的sid)和id
进入https://vip.wps.cn/,之后按照图片操作来获取sid和id:
2.保存本文下方的代码到py文件,或直接下载(密码:mebyz)
[download href="https://301.lanzous.com/imi4Lf0m01i" target="blank"]点击下载[/download]
3.安排个定时任务来每天执行即可(可以部署到各厂商的云函数或云计算平台。)。
import requests
import time
import random
###############初始化区域################
all_user=[
{
"name":"你的名字1",#随便设置,仅仅是推送信息的时候起到标识作用
"sid": "11111111111111111111111111",#请填写你的sid
"id": "11111111111"#填写账号id
},
]
sckey='SCU105688Tccb926969f592ec81c07b74625e67d485f0d9df661ed3'#Server酱微信推送,为空则关闭
#预设的邀请人sid
invitees=[
'V02SimQL8wWmEgMDr9JNRFyGAQoUEbs00ad24d44003db8b00a',
'V02S2UBSfNlvEprMOn70qP3jHPDqiZU00a7ef4a800341c7c3b',
'V02StVuaNcoKrZ3BuvJQ1FcFS_xnG2k00af250d4002664c02f',
'V02SWIvKWYijG6Rggo4m0xvDKj1m7ew00a8e26d3002508b828',
'V02Sr3nJ9IicoHWfeyQLiXgvrRpje6E00a240b890023270f97',
'V02SBsNOf4sJZNFo4jOHdgHg7-2Tn1s00a338776000b669579',
'V02ScVbtm2pQD49ArcgGLv360iqQFLs014c8062e000b6c37b6',
'V02S2oI49T-Jp0_zJKZ5U38dIUSIl8Q00aa679530026780e96',
'V02ShotJqqiWyubCX0VWTlcbgcHqtSQ00a45564e002678124c',
'V02SFiqdXRGnH5oAV2FmDDulZyGDL3M00a61660c0026781be1',
'V02S7tldy5ltYcikCzJ8PJQDSy_ElEs00a327c3c0026782526',
'V02SPoOluAnWda0dTBYTXpdetS97tyI00a16135e002684bb5c',
'V02Sb8gxW2inr6IDYrdHK_ywJnayd6s00ab7472b0026849b17',
'V02SwV15KQ_8n6brU98_2kLnnFUDUOw00adf3fda0026934a7f',
'V02SC1mOHS0RiUBxeoA8NTliH2h2NGc00a803c35002693584d'
]
#预设置的UA
ua=[
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36 Edg/83.0.478.54",
"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36",
"Mozilla/5.0 (Linux; U; Android 10; zh-cn; MI 8 Build/QKQ1.190828.002) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/71.0.3578.141 Mobile Safari/537.36 XiaoMi/MiuiBrowser/12.4.14",
"Mozilla/5.0 (Linux; Android 10; LIO-AL00 Build/HUAWEILIO-AL00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045224 Mobile Safari/537.36 V1_AND_SQ_8.3.9_1424_YYB_D QQ/8.3.9.4635 NetType/WIFI WebP/0.3.0 Pixel/1176 StatusBarHeight/72 SimpleUISwitch/1 QQTheme/2921",
"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36 QQBrowser/4.3.4986.400",
"Mozilla/5.0 (Linux; Android 10; MI 9 Build/QKQ1.190825.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045224 Mobile Safari/537.36 V1_AND_SQ_8.3.9_1424_YYB_D QQ/8.3.9.4635 NetType/WIFI WebP/0.3.0 Pixel/1080 StatusBarHeight/75 SimpleUISwitch/1 QQTheme/2921",
"Mozilla/5.0 (iPhone; CPU iPhone OS 11_2_6 like Mac OS X) AppleWebKit/604.5.6 (KHTML, like Gecko) Version/11.0 Mobile/15D100 Safari/604.1",
"Mozilla/5.0 (iPhone; CPU iPhone OS 11_2_6 like Mac OS X) AppleWebKit/604.5.6 (KHTML, like Gecko) Mobile/15D100 MicroMessenger/6.6.3 NetType/WIFI Language/zh_CN",
"Mozilla/5.0 (iPhone; CPU iPhone OS 11_2_6 like Mac OS X) AppleWebKit/604.5.6 (KHTML, like Gecko) Mobile/15D100 Weibo (iPhone9,1__weibo__8.2.0__iphone__os11.2.6)",
"Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; en-us) AppleWebKit/534.50 (KHTML, like Gecko) Version/5.1 Safari/534.50",
"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36 MicroMessenger/7.0.9.501 NetType/WIFI MiniProgramEnv/Windows WindowsWechat"
]
#问题和答案列表
all_answer=[
{'title': 'WPS Office能打开以下哪种格式文档?', 'answer': ['doc', 'pdf', 'xls', 'ppt']},
{'title': '以下哪些是超级会员35个特权中的一部分?', 'answer': ['海量模板免费下载', 'PDF转word', '100GWPS空间容量']},
{'title': '小李收到一份多页PDF文档,想存储到相册里去,有什么办法?', 'answer': ['WPS会员PDF转图片']},
{'title': 'WPS会员拥有多大的云文档存储空间?', 'answer': ['100G']},
{'title': '老板让小李修改一份纸质文档,小李应该?', 'answer': ['WPS会员拍照转文字']},
{'title': '成为WPS会员能享受什么特权?', 'answer': ['纯净无广告', '云文档批量下载', 'PDF转PPT', 'PDF转word']},
{'title': '老板让小李改一份PDF文档,小李要怎么做?', 'answer': ['WPS会员PDF转doc']},
{'title': '想搜索文档具体内容,有什么方式可以实现?', 'answer': ['WPS全文检索功能']},
{'title': '老板让小李在一万份文档里搜索内容包含了“行程”的全部文档,怎么办?', 'answer': ['WPS会员全文检索']},
{'title': '重要文档损坏了,心急的小李要怎么做?', 'answer': ['使用WPS会员修复']},
{'title': '通过什么工具可以将多张图片转成一个PDF文档?', 'answer': ['WPS图片转PDF插件']},
{'title': '以下哪个是WPS会员特权中的一个?', 'answer': ['文档修复']},
{'title': '小李上班发现自己的硬盘坏了,数据丢失怎么办?', 'answer': ['WPS会员数据恢复']},
{'title': '拍照识图,并转成文字提取出来,是什么会员有的功能?', 'answer': ['WPS会员', 'WPS超级会员']},
{'title': '以下哪种工具能将PDF转成WORD?', 'answer': ['金山PDF转WORD']},
{'title': 'WPS会员21个特权包括以下哪几个?', 'answer': ['批量下载', '图片转PDF', '文档修复']},
{'title': '老板让小李把一百张图片做成一个PDF文档,小李应该?', 'answer': ['WPS会员图片转PDF']},
{'title': '以下哪些特权是WPS会员和超级会员共同拥有的?', 'answer': ['30天文档分享链接有效期', '输出长图片去水印', 'PDF转图片']},
{'title': '遇到磁盘数据损坏,WPS会员有没有数据修复特权?', 'answer': ['有,且无限次']},
]
############ 函数区域 ##########################
def server(text):#Server酱推送(可选)
global sckey
if sckey:
if requests.get(url="https://sc.ftqq.com/{}.send?text={}".format(sckey,text)).json()['errmsg']=='success':
return("推送成功")
else:
return("推送失败")
else:
return("未开启推送")
def random_ua():#随机UA
global ua
return(ua[random.randint(0,len(ua)-1)])
def sign_in(sid):#回答问题和打卡
global all_answer
me_Headers={#初始化头部信息
"sid": sid,
"User-Agent":random_ua(),
"content-type": "application/json",
"Referer": "https://servicewechat.com/wx2f333d84a103825d/85/page-frame.html",
"Connection": "keep-alive",
'Host': 'zt.wps.cn'
}
seesion=requests.session()
answer_str='' #回答问题的文本形式
j=0
while not answer_str:#文本文本为空字符串则循环
#question_get获取问题json
question_get=seesion.get(url='https://zt.wps.cn/2018/clock_in/api/get_question?award=wps',headers=me_Headers,verify=False).json()
#print(question_get)
for i in all_answer:
if question_get['data']['title']==i['title']: #循环已知问题和答案,并找到和问题相同的问题
print(question_get['data']['title'],i['title'],'自动答题')
for j in range(len(question_get['data']['options'])):#判断答案的顺序生成答案字符串
if question_get['data']['options'][j] in i['answer']:
answer_str=answer_str+"%d|"%(j+1)
answer_str=answer_str[0:len(answer_str)-1]#删除最后一个|
break
else:
continue#题目不在已知问题中,则循环
answer={"answer":answer_str}
answer_post=seesion.post(url='https://zt.wps.cn/2018/clock_in/api/answer?member=wps',headers=me_Headers,json=answer,verify=False).json()
if answer_post['result']=='ok' and answer_post['msg']!='wrong answer':
wps_return=seesion.get(url='http://zt.wps.cn/2018/clock_in/api/clock_in?member=wps',headers=me_Headers,verify=False).json()
if wps_return['result']=='ok':
print("打卡报名成功")
elif wps_return['msg']=='前一天未报名':
seesion.get(url='http://zt.wps.cn/2018/clock_in/api/sign_up',headers=me_Headers,verify=False)
print("前一天未报名,今日报名成功")
else:
answer_str=''#回答问题失败则清空
if j>4:
return me_Headers,''
j+=1
continue
return me_Headers,'打卡成功'#返回头部信息,供invitation函数查询次数
def invitation(sid,id,me_Headers):#邀请人确定
global invitees
j=0#次数
invite_count=int(requests.get(url='https://zt.wps.cn/2018/clock_in/api/get_data?member=wps',headers=me_Headers,verify=False).json()['invite_count'])
if invite_count<10:
max_j=invite_count+3#获取最大的循环次数
print("开始",invite_count)
for i in invitees:
if sid==i:
continue
else:
invite_count+=1
medata={
"invite_userid":id,
}
invite_Headers={
"sid": i,
"User-Agent":random_ua(),
}
requests.post(url='http://zt.wps.cn/2018/clock_in/api/invite',data=medata,headers=invite_Headers)
time.sleep(2)
if invite_count>=10:
invite_count=int(requests.get(url='https://zt.wps.cn/2018/clock_in/api/get_data?member=wps',headers=me_Headers,verify=False).json()['invite_count'])
print("验证",invite_count)
if invite_count>=10:
return("邀请十人成功")
else:
j+=1
if j>=max_j:
return("循环次数过多")
else:
return("今天已完成邀请,未执行")
def main():
for i in all_user:
print(i['name']+'开始执行:')
me_Headers,text=sign_in(i['sid'])
if text:
text=text+","+invitation(i['sid'],i['id'],me_Headers)
server(i['name']+text)
else:
server('{}登录或答题失败'.format(i['name']))
if __name__ == "__main__":
usersid_list=[]
for i in all_user:#获取所有预执行的人员sid,并与预设的邀请人名单进行拼接
print(i)
usersid_list.append(i['sid'])
usersid_list.extend(invitees)
invitees=usersid_list
main()
优秀。没用wps,想问问签到有什么用?
签到打卡能领wps普通会员(打卡多少天给多少天),一些会员功能挺好的,PPT ,Word ,PDF相互转换等。但现在自动签到打卡功能失效了,现在脚本只能每天只能通过邀请人来增加天数,相当于自己手动打卡一天能给十一天。