From 32c3c41ba5511be0be022fbe17af77b7c8a9b6fa Mon Sep 17 00:00:00 2001 From: GamerNoTitle Date: Mon, 7 Dec 2020 16:37:23 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E5=A4=9A?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=88=86=E6=94=AF=20#3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 334e4e1..2e1a0a9 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ 签到时间是早上10点,如果有需要就自己修改.github/workflows/AutoSignin.yml中第12行的时间,时间遵循UTC时间,+8才是我们的时间 +`你当前预览的是多用户分支,该分支正在开发……` + ## 赞助 点击下面的Badge其中一个就可以跳转到相应页面,感谢老板的支持! From aa9f09de71b2b56b3b9ce07281726dcf42c2459f Mon Sep 17 00:00:00 2001 From: GamerNoTitle Date: Sat, 12 Dec 2020 18:17:15 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E6=95=B4=E7=90=86=E8=84=9A=E6=9C=AC?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E5=B9=B6=E4=BC=98=E5=8C=96=EF=BC=8C=E5=8A=A0?= =?UTF-8?q?=E5=85=A5=E5=A4=9A=E7=94=A8=E6=88=B7=E5=9F=BA=E7=A1=80=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 144 ++++++++++++++++++++++++++++++-------------------------- 1 file changed, 78 insertions(+), 66 deletions(-) diff --git a/main.py b/main.py index 7fcbf58..e4f3b5c 100644 --- a/main.py +++ b/main.py @@ -8,11 +8,11 @@ sc_enable=False sign='https://n.cg.163.com/api/v2/sign-today' current='https://n.cg.163.com/api/v2/client-settings/@current' -cookie=sys.argv[1] -teleid=sys.argv[2] -teletoken=sys.argv[3] +cookies=sys.argv[1].split('#') +teleid="" #sys.argv[2] +teletoken="" #sys.argv[3] sckey=sys.argv[4] -if cookie=="": +if cookies=="": print('[网易云游戏自动签到]未设置cookie,正在退出……') sys.exit() if teleid!="" and teletoken!="": @@ -21,44 +21,46 @@ if teleid!="" and teletoken!="": if sckey!="": sc_enable=True -getheader={ - 'Host': 'n.cg.163.com', - 'Connection': 'keep-alive', - 'Accept': 'application/json, text/plain, */*', - 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36', - 'X-Platform': '0', - 'Authorization': str(cookie), - 'Origin': 'https://cg.163.com', - 'Sec-Fetch-Site': 'same-site', - 'Sec-Fetch-Mode': 'cors', - 'Sec-Fetch-Dest': 'empty', - 'Referer': 'https://cg.163.com/', - 'Accept-Encoding': 'gzip, deflate, br', - 'Accept-Language': 'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7,ja-JP;q=0.6,ja;q=0.5' -} +class Error(Exception): + pass -signheader={ - 'Accept': 'application/json, text/plain, */*', - 'Accept-Encoding': 'gzip, deflate, br', - 'Accept-Language': 'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7,ja-JP;q=0.6,ja;q=0.5', - 'Authorization': str(cookie), - 'Connection': 'keep-alive', - 'Content-Length': '0', - 'Host': 'n.cg.163.com', - 'Origin': 'https://cg.163.com', - 'Referer': 'https://cg.163.com/', - '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/86.0.4240.198 Safari/537.36', - 'X-Platform': '0' -} +def signin(url,cookie): + header={ + 'Accept': 'application/json, text/plain, */*', + 'Accept-Encoding': 'gzip, deflate, br', + 'Accept-Language': 'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7,ja-JP;q=0.6,ja;q=0.5', + 'Authorization': str(cookie), + 'Connection': 'keep-alive', + 'Content-Length': '0', + 'Host': 'n.cg.163.com', + 'Origin': 'https://cg.163.com', + 'Referer': 'https://cg.163.com/', + '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/86.0.4240.198 Safari/537.36', + 'X-Platform': '0' + } -def signin(url,header): result=r.post(url=url,headers=header) return result -def getme(url,header): +def getme(url,cookie): + header={ + 'Host': 'n.cg.163.com', + 'Connection': 'keep-alive', + 'Accept': 'application/json, text/plain, */*', + 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36', + 'X-Platform': '0', + 'Authorization': str(cookie), + 'Origin': 'https://cg.163.com', + 'Sec-Fetch-Site': 'same-site', + 'Sec-Fetch-Mode': 'cors', + 'Sec-Fetch-Dest': 'empty', + 'Referer': 'https://cg.163.com/', + 'Accept-Encoding': 'gzip, deflate, br', + 'Accept-Language': 'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7,ja-JP;q=0.6,ja;q=0.5' + } result=r.get(url=url,headers=header) return result @@ -71,33 +73,43 @@ def scsend(SCKEY,message): if sc_enable: r.get(url=sc_url) -class ScriptError(Exception): - pass - -class GetInfoError(ScriptError): - pass - -class CheckInError(ScriptError): - pass - - if __name__ == "__main__": - me=getme(current,getheader) - if(me.status_code!=200): - message='[网易云游戏自动签到]验证失败!请检查Cookie是否过期!或者附上报错信息到 https://github.com/GamerNoTitle/wyycg-autosignin/issues 发起issue' - send(teleid,message) - scsend(sckey,message) - print(message) - raise GetInfoError - sign=signin(sign,signheader) - if(sign.status_code==200): - message='[网易云游戏自动签到]签到成功!' - send(teleid,message) - scsend(sckey,message) - print(message) - else: - message='[网易云游戏自动签到]签到失败,回显状态码为{}\n具体错误信息如下:\n{}'.format(sign.status_code,sign.text) - send(teleid,message) - scsend(sckey,message) - print(message) - raise(CheckInError) + success=[] + failure=[] + msg=[] + print(len(cookies)) + for i in cookies: + print(i) + cookie=i + me=getme(current,cookie) + + if(me.status_code!=200): + message='第{}个账号验证失败!请检查Cookie是否过期!或者附上报错信息到 https://github.com/GamerNoTitle/wyycg-autosignin/issues 发起issue'.format(cookies.index(i)+1) + failure.append(cookie) + msg.append(message) + + sign=signin(sign,cookie) + + if(sign.status_code==200): + message='第{}个账号签到成功!'.format(cookies.index(i)+1) + success.append(cookie) + msg.append(message) + else: + print("fail") + message='第{}个账号签到失败,回显状态码为{}\n具体错误信息如下:\n{}'.format(cookies.index(i)+1,sign.status_code,sign.text) + failure.append(cookie) + msg.append(message) + outputmsg=str(msg).replace("[",'').replace(']','').replace(',','
').replace('\'','') + infomsg=''' + 感谢使用来自GamerNoTitle网易云游戏自动签到脚本
+ 今日签到结果如下:
+ 成功数量:{0}/{2}
+ 失败数量:{1}/{2}
+ 具体情况如下:
+ {3} + '''.format(len(success),len(failure),len(cookies),outputmsg) + scsend(sckey,infomsg) + send(teleid,infomsg) + print(infomsg) + if(len(msg)!=0): + raise Error \ No newline at end of file From 98ec27ca998816d0a992ada43ba758ffa5c88e8b Mon Sep 17 00:00:00 2001 From: GamerNoTitle Date: Sat, 12 Dec 2020 19:04:43 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E8=B0=83=E8=AF=95=E5=B9=B6=E4=BF=AE?= =?UTF-8?q?=E5=A4=8DBUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/main.py b/main.py index e4f3b5c..93c4966 100644 --- a/main.py +++ b/main.py @@ -81,21 +81,30 @@ if __name__ == "__main__": for i in cookies: print(i) cookie=i - me=getme(current,cookie) - - if(me.status_code!=200): + try: + me=getme(current,cookie) + except: message='第{}个账号验证失败!请检查Cookie是否过期!或者附上报错信息到 https://github.com/GamerNoTitle/wyycg-autosignin/issues 发起issue'.format(cookies.index(i)+1) failure.append(cookie) msg.append(message) - sign=signin(sign,cookie) + if(me.status_code!=200): + message='第{}个账号验证失败!请检查Cookie是否过期!或者附上报错信息到 https://github.com/GamerNoTitle/wyycg-autosignin/issues 发起issue'.format(cookies.index(i)+1) + failure.append(cookie) + msg.append(message) + + try: + sign=signin(sign,cookie) + except: + message='第{}个账号签到失败,回显状态码为{}\n具体错误信息如下:\n{}'.format(cookies.index(i)+1,sign.status_code,sign.text) + failure.append(cookie) + msg.append(message) if(sign.status_code==200): message='第{}个账号签到成功!'.format(cookies.index(i)+1) success.append(cookie) msg.append(message) else: - print("fail") message='第{}个账号签到失败,回显状态码为{}\n具体错误信息如下:\n{}'.format(cookies.index(i)+1,sign.status_code,sign.text) failure.append(cookie) msg.append(message) From 4bb049cb2ba78ed4d70efe50a05163f4673ccb03 Mon Sep 17 00:00:00 2001 From: GamerNoTitle Date: Sat, 12 Dec 2020 19:10:17 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=A1=E6=95=B0?= =?UTF-8?q?=E9=80=BB=E8=BE=91=EF=BC=8C=E4=BF=AE=E5=A4=8D=E8=AE=A1=E6=95=B0?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 93c4966..d9ad1dd 100644 --- a/main.py +++ b/main.py @@ -81,30 +81,34 @@ if __name__ == "__main__": for i in cookies: print(i) cookie=i + autherror=False + signerror=False try: me=getme(current,cookie) except: message='第{}个账号验证失败!请检查Cookie是否过期!或者附上报错信息到 https://github.com/GamerNoTitle/wyycg-autosignin/issues 发起issue'.format(cookies.index(i)+1) failure.append(cookie) msg.append(message) + autherror=True - if(me.status_code!=200): + if(me.status_code!=200 and autherror!=True): message='第{}个账号验证失败!请检查Cookie是否过期!或者附上报错信息到 https://github.com/GamerNoTitle/wyycg-autosignin/issues 发起issue'.format(cookies.index(i)+1) failure.append(cookie) msg.append(message) - + try: sign=signin(sign,cookie) except: message='第{}个账号签到失败,回显状态码为{}\n具体错误信息如下:\n{}'.format(cookies.index(i)+1,sign.status_code,sign.text) failure.append(cookie) msg.append(message) + signerror=True if(sign.status_code==200): message='第{}个账号签到成功!'.format(cookies.index(i)+1) success.append(cookie) msg.append(message) - else: + elif(signerror!=True): message='第{}个账号签到失败,回显状态码为{}\n具体错误信息如下:\n{}'.format(cookies.index(i)+1,sign.status_code,sign.text) failure.append(cookie) msg.append(message) From 8d4dd91f6137d99f28f509de9d46286bc3cc2b2e Mon Sep 17 00:00:00 2001 From: GamerNoTitle Date: Sat, 12 Dec 2020 19:15:08 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E8=B0=83=E8=AF=95?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=B9=B6=E5=AE=8C=E6=88=90=E5=A4=9A=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E7=AD=BE=E5=88=B0=20#3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index d9ad1dd..7ea2061 100644 --- a/main.py +++ b/main.py @@ -9,8 +9,8 @@ sign='https://n.cg.163.com/api/v2/sign-today' current='https://n.cg.163.com/api/v2/client-settings/@current' cookies=sys.argv[1].split('#') -teleid="" #sys.argv[2] -teletoken="" #sys.argv[3] +teleid=sys.argv[2] +teletoken=sys.argv[3] sckey=sys.argv[4] if cookies=="": print('[网易云游戏自动签到]未设置cookie,正在退出……') @@ -99,7 +99,7 @@ if __name__ == "__main__": try: sign=signin(sign,cookie) except: - message='第{}个账号签到失败,回显状态码为{}\n具体错误信息如下:\n{}'.format(cookies.index(i)+1,sign.status_code,sign.text) + message='第{}个账号签到失败,回显状态码为{},具体错误信息如下:{}'.format(cookies.index(i)+1,sign.status_code,sign.text) failure.append(cookie) msg.append(message) signerror=True @@ -109,7 +109,7 @@ if __name__ == "__main__": success.append(cookie) msg.append(message) elif(signerror!=True): - message='第{}个账号签到失败,回显状态码为{}\n具体错误信息如下:\n{}'.format(cookies.index(i)+1,sign.status_code,sign.text) + message='第{}个账号签到失败,回显状态码为{},具体错误信息如下:{}'.format(cookies.index(i)+1,sign.status_code,sign.text) failure.append(cookie) msg.append(message) outputmsg=str(msg).replace("[",'').replace(']','').replace(',','
').replace('\'','') From 751c9108d484da0ed995210e64524fbb6b1aa240 Mon Sep 17 00:00:00 2001 From: GamerNoTitle Date: Sat, 12 Dec 2020 19:19:45 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E5=B0=86ServerChan=E7=9A=84=E6=8E=A8?= =?UTF-8?q?=E9=80=81=E4=B8=8ETelegram=E7=9A=84=E6=8E=A8=E9=80=81=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E5=88=86=E5=BC=80=E8=B5=8B=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 -- main.py | 17 +++++++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 2e1a0a9..334e4e1 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,6 @@ 签到时间是早上10点,如果有需要就自己修改.github/workflows/AutoSignin.yml中第12行的时间,时间遵循UTC时间,+8才是我们的时间 -`你当前预览的是多用户分支,该分支正在开发……` - ## 赞助 点击下面的Badge其中一个就可以跳转到相应页面,感谢老板的支持! diff --git a/main.py b/main.py index 7ea2061..80f8f97 100644 --- a/main.py +++ b/main.py @@ -113,7 +113,15 @@ if __name__ == "__main__": failure.append(cookie) msg.append(message) outputmsg=str(msg).replace("[",'').replace(']','').replace(',','
').replace('\'','') - infomsg=''' + teleinfomsg=''' + 感谢使用来自GamerNoTitle的网易云游戏自动签到脚本! + 今日签到结果如下: + 成功数量:{0}/{2} + 失败数量:{1}/{2} + 具体情况如下: + {3} + '''.format(len(success),len(failure),len(cookies),outputmsg) + scinfomsg=''' 感谢使用来自GamerNoTitle网易云游戏自动签到脚本
今日签到结果如下:
成功数量:{0}/{2}
@@ -121,8 +129,9 @@ if __name__ == "__main__": 具体情况如下:
{3} '''.format(len(success),len(failure),len(cookies),outputmsg) - scsend(sckey,infomsg) - send(teleid,infomsg) - print(infomsg) + + scsend(sckey,scinfomsg) + send(teleid,teleinfomsg) + print(scinfomsg) if(len(msg)!=0): raise Error \ No newline at end of file