From 14f000d9d72496a1539f239ece0bbbddc6cb4022 Mon Sep 17 00:00:00 2001 From: y1ndan Date: Sun, 27 Dec 2020 19:45:21 +0800 Subject: [PATCH 01/10] refactor: code update --- genshin.py | 83 +++++++++++++++++++++++++++--------------------------- 1 file changed, 41 insertions(+), 42 deletions(-) diff --git a/genshin.py b/genshin.py index 94af84b..4b6c37d 100755 --- a/genshin.py +++ b/genshin.py @@ -18,8 +18,19 @@ logging.basicConfig( class ConfMeta(type): @property - def index_url(self): - return 'https://webstatic.mihoyo.com/bbs/event/signin-ys/index.html' + def ref_url(self): + return 'https://webstatic.mihoyo.com/bbs/event/signin-ys/index.html?' \ + 'bbs_auth_required={}&act_id={}&utm_source={}&utm_medium={}&' \ + 'utm_campaign={}'.format('true', self.act_id, 'bbs', 'mys', 'icon') + + @property + def role_url(self): + return 'https://api-takumi.mihoyo.com/binding/api/' \ + 'getUserGameRolesByCookie?game_biz={}'.format('hk4e_cn') + + @property + def sign_url(self): + return 'https://api-takumi.mihoyo.com/event/bbs_sign_reward/sign' @property def app_version(self): @@ -27,9 +38,12 @@ class ConfMeta(type): @property def ua(self): - return 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_0_1 like Mac OS X) ' \ - 'AppleWebKit/605.1.15 (KHTML, like Gecko) miHoYoBBS/%s' \ - %(self.app_version) + return 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_0_1 like Mac OS X) Apple' \ + 'WebKit/605.1.15 (KHTML, like Gecko) miHoYoBBS/{}'.format(self.app_version) + + @property + def act_id(self): + return 'e202009291139501' class Conf(metaclass=ConfMeta): @@ -39,22 +53,14 @@ class Conf(metaclass=ConfMeta): class Roles(object): def __init__(self, cookie:str=None): if type(cookie) is not str: - raise TypeError("%s want a %s but got %s" %( + raise TypeError('%s want a %s but got %s' %( self.__class__, type(__name__), type(cookie))) - self._cookie = cookie - self._url = "https://api-takumi.mihoyo.com/binding/api/" \ - "getUserGameRolesByCookie?game_biz=%s" %('hk4e_cn') - def get_header(self): - actid = 'e202009291139501' - ref = "%s?bbs_auth_required=%s&act_id=%s&utm_source=%s" \ - "&utm_medium=%s&utm_campaign=%s" %( - Conf.index_url, 'true', actid, 'bbs', 'mys', 'icon') - + self._cookie = cookie return { 'User-Agent': Conf.ua, - 'Referer': ref, + 'Referer': Conf.ref_url, 'Accept-Encoding': 'gzip, deflate, br', 'Cookie': self._cookie } @@ -63,7 +69,7 @@ class Roles(object): try: jdict = json.loads( requests.Session().get( - self._url, headers = self.get_header()).text) + Conf.role_url, headers = self.get_header()).text) except Exception as e: logging.error(e) raise HTTPError @@ -78,19 +84,19 @@ class Roles(object): try: self._rolesInfo = self.get_roles() except HTTPError as e: - logging.error("HTTP error when get user game roles, " \ - "retry %s time(s) ..." %(i)) - logging.error("error is %s" %(e)) + logging.error('HTTP error when get user game roles, ' \ + 'retry %s time(s) ...' %(i)) + logging.error('error is %s' %(e)) errstr = str(e) continue except KeyError as e: - logging.error("Wrong response to get user game roles, " \ - "retry %s time(s) ..." %(i)) - logging.error("response is %s" %(e)) + logging.error('Wrong response to get user game roles, ' \ + 'retry %s time(s) ...' %(i)) + logging.error('response is %s' %(e)) errstr = str(e) continue except Exception as e: - logging.error("Unknown error %s, die" %(e)) + logging.error('Unknown error %s, die' %(e)) errstr = str(e) raise else: @@ -100,38 +106,31 @@ class Roles(object): self._rolesInfo except AttributeError: raise Exception(errstr) - + return self._rolesInfo class Sign(object): def __init__(self, cookie:str=None): if type(cookie) is not str: - raise TypeError("%s want a %s but got %s" %( + raise TypeError('%s want a %s but got %s' %( self.__class__, type(__name__), type(cookie))) - self._cookie = cookie - self._url = 'https://api-takumi.mihoyo.com/event/bbs_sign_reward/sign' - # Provided by Steesha def md5(self, text): md5 = hashlib.md5() md5.update(text.encode()) - return (md5.hexdigest()) + return md5.hexdigest() def get_DS(self): n = self.md5(Conf.app_version) i = str(int(time.time())) r = ''.join(random.sample(string.ascii_lowercase + string.digits, 6)) - c = self.md5("salt=" + n + "&t="+ i + "&r=" + r) - return i + "," + r + "," + c + c = self.md5('salt=' + n + '&t='+ i + '&r=' + r) + return '{},{},{}'.format(i, r, c) def get_header(self): - actid = 'e202009291139501' - ref = "%s?bbs_auth_required=%s&act_id=%s&utm_source=%s" \ - "&utm_medium=%s&utm_campaign=%s" %( - Conf.index_url, 'true', actid, 'bbs', 'mys', 'icon') - + self._cookie = cookie return { 'x-rpc-device_id': str(uuid.uuid3( uuid.NAMESPACE_URL, self._cookie)).replace('-','').upper(), @@ -142,7 +141,7 @@ class Sign(object): 'x-rpc-client_type': '5', 'Accept-Encoding': 'gzip, deflate, br', 'User-Agent': Conf.ua, - 'Referer': ref, + 'Referer': Conf.ref_url, 'x-rpc-app_version': Conf.app_version, 'DS': self.get_DS(), 'Cookie': self._cookie @@ -156,7 +155,7 @@ class Sign(object): self._uid = rolesList[i]['game_uid'] data = { - 'act_id': 'e202009291139501', + 'act_id': Conf.act_id, 'region': self._region, 'uid': self._uid } @@ -165,7 +164,7 @@ class Sign(object): i+1, str(self._uid).replace(str(self._uid)[3:6],'***',1), self._region_name)) try: jdict = json.loads(requests.Session().post( - self._url, headers = self.get_header(), + Conf.sign_url, headers = self.get_header(), data = json.dumps(data, ensure_ascii=False)).text) except Exception as e: raise @@ -199,13 +198,13 @@ def notify(key, massage): except Exception as e: logging.error(e) raise HTTPError - + return jdict else: logging.info('未配置SCKEY,正在跳过推送...') -if __name__ == "__main__": +if __name__ == '__main__': secret = input().strip().split('#') secret.append('') cookie=secret[0] From 1078a5674dea23059179e6fc94e48686e6436362 Mon Sep 17 00:00:00 2001 From: y1ndan Date: Mon, 28 Dec 2020 10:19:22 +0800 Subject: [PATCH 02/10] refactor: add preset links; code update --- genshin.py | 49 +++++++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/genshin.py b/genshin.py index 4b6c37d..4494253 100755 --- a/genshin.py +++ b/genshin.py @@ -23,11 +23,21 @@ class ConfMeta(type): 'bbs_auth_required={}&act_id={}&utm_source={}&utm_medium={}&' \ 'utm_campaign={}'.format('true', self.act_id, 'bbs', 'mys', 'icon') + @property + def award_url(self): + return 'https://api-takumi.mihoyo.com/event/bbs_sign_reward/home?' \ + 'act_id={}'.format(self.act_id) + @property def role_url(self): return 'https://api-takumi.mihoyo.com/binding/api/' \ 'getUserGameRolesByCookie?game_biz={}'.format('hk4e_cn') + @property + def check_url(self): + return 'https://api-takumi.mihoyo.com/event/bbs_sign_reward/info?' \ + 'region={}&act_id={}&uid={}' + @property def sign_url(self): return 'https://api-takumi.mihoyo.com/event/bbs_sign_reward/sign' @@ -55,9 +65,9 @@ class Roles(object): if type(cookie) is not str: raise TypeError('%s want a %s but got %s' %( self.__class__, type(__name__), type(cookie))) + self._cookie = cookie def get_header(self): - self._cookie = cookie return { 'User-Agent': Conf.ua, 'Referer': Conf.ref_url, @@ -66,23 +76,14 @@ class Roles(object): } def get_roles(self): - try: - jdict = json.loads( - requests.Session().get( - Conf.role_url, headers = self.get_header()).text) - except Exception as e: - logging.error(e) - raise HTTPError - - return jdict - - def get_rolesInfo(self): logging.info('Start getting user information ...') errstr = None for i in range(1, 4): try: - self._rolesInfo = self.get_roles() + jdict = json.loads( + requests.Session().get( + Conf.role_url, headers = self.get_header()).text) except HTTPError as e: logging.error('HTTP error when get user game roles, ' \ 'retry %s time(s) ...' %(i)) @@ -103,11 +104,11 @@ class Roles(object): break try: - self._rolesInfo + jdict except AttributeError: raise Exception(errstr) - return self._rolesInfo + return jdict class Sign(object): @@ -115,6 +116,7 @@ class Sign(object): if type(cookie) is not str: raise TypeError('%s want a %s but got %s' %( self.__class__, type(__name__), type(cookie))) + self._cookie = cookie # Provided by Steesha def md5(self, text): @@ -130,7 +132,6 @@ class Sign(object): return '{},{},{}'.format(i, r, c) def get_header(self): - self._cookie = cookie return { 'x-rpc-device_id': str(uuid.uuid3( uuid.NAMESPACE_URL, self._cookie)).replace('-','').upper(), @@ -181,19 +182,19 @@ def makeResult(result:str, data=None): sort_keys=False, indent=2, ensure_ascii=False ) -def notify(key, massage): - if key != '': +def notify(sckey, massage): + if sckey != '': logging.info('正在推送通知...') - url = 'https://sc.ftqq.com/%s.send' %(key) + url = 'https://sc.ftqq.com/{}.send'.format(sckey) data = {'text':'原神签到小助手', 'desp':massage} try: jdict = json.loads( requests.Session().post(url, data = data).text) errmsg = jdict['errmsg'] if errmsg == 'success': - logging.info('推送通知成功') + logging.info('推送成功') else: - logging.info('推送通知失败') + logging.error('推送失败') logging.error(jdict) except Exception as e: logging.error(e) @@ -207,9 +208,9 @@ def notify(key, massage): if __name__ == '__main__': secret = input().strip().split('#') secret.append('') - cookie=secret[0] - sckey=secret[1] - jstr = Roles(cookie).get_rolesInfo() + cookie = secret[0] + sckey = secret[1] + jstr = Roles(cookie).get_roles() result = makeResult('Failed', jstr) ret = -1 From f96ad51f2d638a4b1e66d7e7acb4118ec4bb6e0c Mon Sep 17 00:00:00 2001 From: y1ndan Date: Wed, 30 Dec 2020 16:21:11 +0800 Subject: [PATCH 03/10] refactor: better logic judgment; beautify the notification style --- genshin.py | 197 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 115 insertions(+), 82 deletions(-) diff --git a/genshin.py b/genshin.py index 4494253..5623251 100755 --- a/genshin.py +++ b/genshin.py @@ -34,7 +34,7 @@ class ConfMeta(type): 'getUserGameRolesByCookie?game_biz={}'.format('hk4e_cn') @property - def check_url(self): + def info_url(self): return 'https://api-takumi.mihoyo.com/event/bbs_sign_reward/info?' \ 'region={}&act_id={}&uid={}' @@ -75,15 +75,24 @@ class Roles(object): 'Cookie': self._cookie } + def get_awards(self): + try: + jdict = json.loads( + requests.Session().get( + Conf.award_url, headers = self.get_header()).text) + except Exception as e: + logging.error(e) + + return jdict + def get_roles(self): - logging.info('Start getting user information ...') + logging.info('准备获取账号信息...') errstr = None for i in range(1, 4): try: - jdict = json.loads( - requests.Session().get( - Conf.role_url, headers = self.get_header()).text) + jdict = json.loads(requests.Session().get( + Conf.role_url, headers = self.get_header()).text) except HTTPError as e: logging.error('HTTP error when get user game roles, ' \ 'retry %s time(s) ...' %(i)) @@ -148,61 +157,116 @@ class Sign(object): 'Cookie': self._cookie } - def run(self): - # cn_gf01: 天空岛 - # cn_qd01: 世界树 - self._region = rolesList[i]['region'] - self._region_name = rolesList[i]['region_name'] - self._uid = rolesList[i]['game_uid'] - - data = { - 'act_id': Conf.act_id, - 'region': self._region, - 'uid': self._uid - } - - logging.info('Start signing in the NO.%s role which UID is %s in %s ...' %( - i+1, str(self._uid).replace(str(self._uid)[3:6],'***',1), self._region_name)) + def get_info(self): + roles = Roles(self._cookie).get_roles() try: - jdict = json.loads(requests.Session().post( - Conf.sign_url, headers = self.get_header(), - data = json.dumps(data, ensure_ascii=False)).text) + rolesList = roles['data']['list'] except Exception as e: - raise + massage = roles['massage'] + notify(sckey, '失败', massage) + exit(-1) + else: + logging.info('当前账号绑定了 {} 个角色'.format(len(rolesList))) + infoList = [] + # cn_gf01: 天空岛 + # cn_qd01: 世界树 + self._regionList = [(i.get('region', 'NA')) for i in rolesList] + self._regionNameList = [(i.get('region_name', 'NA')) for i in rolesList] + self._uidList = [(i.get('game_uid', 'NA')) for i in rolesList] - return jdict + logging.info('准备获取签到信息...') + for i in range(len(self._uidList)): + info_url = Conf.info_url.format(self._regionList[i], + Conf.act_id, self._uidList[i]) + try: + infoList.append(json.loads(requests.Session().get( + info_url, headers = self.get_header()).text)) + except Exception as e: + logging.error(e) + + return infoList + + def run(self): + logging.info('任务开始') + massageList = [] + infoList = self.get_info() + for i in range(len(infoList)): + if infoList[i]['data']['is_sign'] is True: + #if infoList[i]['data']['is_sign'] is False: + massage = '旅行者 {} 号,你已经签到过了'.format(i + 1) + notify(sckey, '成功', massage) + elif infoList[i]['data']['first_bind'] is True: + massage = '旅行者 {} 号,请先前往米游社绑定账号'.format(i + 1) + notify(sckey, '失败', massage) + exit(-1) + else: + today = infoList[i]['data']['today'] + totalSignDay = infoList[i]['data']['total_sign_day'] + award = Roles(self._cookie).get_awards()['data']['awards'][totalSignDay - 1] + uid = str(self._uidList[i]).replace( + str(self._uidList[i])[3:6], '***', 1) + data = { + 'act_id': Conf.act_id, + 'region': self._regionList[i], + 'uid': self._uidList[i] + } + + logging.info('准备为旅行者 {} 号签到...' \ + '\nRegion: {}\nUID: {}'.format(i + 1, self._regionNameList[i], uid)) + try: + jdict = json.loads(requests.Session().post( + Conf.sign_url, headers = self.get_header(), + data = json.dumps(data, ensure_ascii=False)).text) + except Exception as e: + raise + else: + code = jdict['retcode'] + # 0: success + # -5003: already signed in + if code == 0: + status = '成功' + massageList.append(self.massage().format(today, + self._regionNameList[i], uid, award['name'], award['cnt'], + totalSignDay, jdict['massage'])) + else: + status = '失败' + massageList = jdict + + return notify(sckey, status, massageList) + + def massage(self): + return ''' + {:#^30} + 🔅[{}]{} + 今日奖励: {} × {} + 本月累签: {} 天 + 签到结果: {} + {:#^30} + ''' -def makeResult(result:str, data=None): - return json.dumps( - { - 'result': result, - 'message': data - }, - sort_keys=False, indent=2, ensure_ascii=False - ) - -def notify(sckey, massage): - if sckey != '': - logging.info('正在推送通知...') +def notify(sckey, status, massage): + if sckey.startswith('SC'): + logging.info('准备推送通知...') url = 'https://sc.ftqq.com/{}.send'.format(sckey) - data = {'text':'原神签到小助手', 'desp':massage} + data = {'text': '原神签到小助手 签到{}'.format(status), 'desp': massage} try: jdict = json.loads( requests.Session().post(url, data = data).text) + except Exception as e: + logging.error(e) + raise HTTPError + else: errmsg = jdict['errmsg'] if errmsg == 'success': logging.info('推送成功') else: - logging.error('推送失败') - logging.error(jdict) - except Exception as e: - logging.error(e) - raise HTTPError - - return jdict + logging.error('{}: {}'.format('推送失败', jdict)) else: - logging.info('未配置SCKEY,正在跳过推送...') + logging.info('未配置SCKEY,正在跳过推送') + + logging.info('签到{}: {}'.format(status, massage)) + return logging.info('任务结束') if __name__ == '__main__': @@ -210,42 +274,11 @@ if __name__ == '__main__': secret.append('') cookie = secret[0] sckey = secret[1] - jstr = Roles(cookie).get_roles() - result = makeResult('Failed', jstr) - ret = -1 + seconds = random.randint(10, 300) + #seconds = random.randint(1, 3) - try: - rolesList = jstr['data']['list'] - logging.info('Your account has been bound %s role(s)' %(len(rolesList))) + logging.info('将在 {} 秒后开始任务...'.format(seconds)) + time.sleep(seconds) - for i in range(len(rolesList)): - seconds = random.randint(10, 300) - logging.info('Sleep for %s seconds ...' %(seconds)) - time.sleep(seconds) + Sign(cookie).run() - try: - jdict = Sign(cookie).run() - jstr = json.dumps(jdict, ensure_ascii=False) - code = jdict['retcode'] - except Exception as e: - jstr = str(e) - - try: - code - except NameError: - code = -1 - - # 0: success - # -5003: already signed in - if code in [0, -5003]: - result = makeResult('Success', jstr) - ret = 0 - - logging.info(result) - - except Exception as e: - logging.info(result) - - notify(sckey, result) - logging.info('签到完成!') - exit(ret) From 662c02c7e58acd77278039d590ae37d6cbc2443b Mon Sep 17 00:00:00 2001 From: y1ndan Date: Wed, 30 Dec 2020 19:20:12 +0800 Subject: [PATCH 04/10] fix: update DS --- genshin.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/genshin.py b/genshin.py index 5623251..e493767 100755 --- a/genshin.py +++ b/genshin.py @@ -44,12 +44,12 @@ class ConfMeta(type): @property def app_version(self): - return '2.1.0' + return '2.2.1' @property def ua(self): return 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_0_1 like Mac OS X) Apple' \ - 'WebKit/605.1.15 (KHTML, like Gecko) miHoYoBBS/{}'.format(self.app_version) + 'WebKit/605.1.15 (KHTML, like Gecko) miHoYoBBS/2.2.0' @property def act_id(self): @@ -134,7 +134,8 @@ class Sign(object): return md5.hexdigest() def get_DS(self): - n = self.md5(Conf.app_version) + # n = self.md5(Conf.app_version) # V2.1.0 + n = 'cx2y9z9a29tfqvr1qsq6c7yz99b5jsqt' i = str(int(time.time())) r = ''.join(random.sample(string.ascii_lowercase + string.digits, 6)) c = self.md5('salt=' + n + '&t='+ i + '&r=' + r) From 5c2d54470c2b3a9460149526fff5a1f506e96b52 Mon Sep 17 00:00:00 2001 From: y1ndan Date: Thu, 31 Dec 2020 09:47:12 +0800 Subject: [PATCH 05/10] refactor: change text 'massage' to 'message' --- genshin.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/genshin.py b/genshin.py index e493767..7e1b40e 100755 --- a/genshin.py +++ b/genshin.py @@ -163,8 +163,8 @@ class Sign(object): try: rolesList = roles['data']['list'] except Exception as e: - massage = roles['massage'] - notify(sckey, '失败', massage) + message = roles['message'] + notify(sckey, '失败', message) exit(-1) else: logging.info('当前账号绑定了 {} 个角色'.format(len(rolesList))) @@ -189,16 +189,16 @@ class Sign(object): def run(self): logging.info('任务开始') - massageList = [] + messageList = [] infoList = self.get_info() for i in range(len(infoList)): if infoList[i]['data']['is_sign'] is True: #if infoList[i]['data']['is_sign'] is False: - massage = '旅行者 {} 号,你已经签到过了'.format(i + 1) - notify(sckey, '成功', massage) + message = '旅行者 {} 号,你已经签到过了'.format(i + 1) + notify(sckey, '成功', message) elif infoList[i]['data']['first_bind'] is True: - massage = '旅行者 {} 号,请先前往米游社绑定账号'.format(i + 1) - notify(sckey, '失败', massage) + message = '旅行者 {} 号,请先前往米游社绑定账号'.format(i + 1) + notify(sckey, '失败', message) exit(-1) else: today = infoList[i]['data']['today'] @@ -226,16 +226,16 @@ class Sign(object): # -5003: already signed in if code == 0: status = '成功' - massageList.append(self.massage().format(today, + messageList.append(self.message().format(today, self._regionNameList[i], uid, award['name'], award['cnt'], - totalSignDay, jdict['massage'])) + totalSignDay, jdict['message'])) else: status = '失败' - massageList = jdict + messageList = jdict - return notify(sckey, status, massageList) + return notify(sckey, status, messageList) - def massage(self): + def message(self): return ''' {:#^30} 🔅[{}]{} @@ -246,11 +246,11 @@ class Sign(object): ''' -def notify(sckey, status, massage): +def notify(sckey, status, message): if sckey.startswith('SC'): logging.info('准备推送通知...') url = 'https://sc.ftqq.com/{}.send'.format(sckey) - data = {'text': '原神签到小助手 签到{}'.format(status), 'desp': massage} + data = {'text': '原神签到小助手 签到{}'.format(status), 'desp': message} try: jdict = json.loads( requests.Session().post(url, data = data).text) @@ -266,7 +266,7 @@ def notify(sckey, status, massage): else: logging.info('未配置SCKEY,正在跳过推送') - logging.info('签到{}: {}'.format(status, massage)) + logging.info('签到{}: {}'.format(status, message)) return logging.info('任务结束') From b971c916dcc791f98a9362a395693a69e884a1fa Mon Sep 17 00:00:00 2001 From: y1ndan Date: Thu, 31 Dec 2020 10:04:51 +0800 Subject: [PATCH 06/10] fix: output error --- genshin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/genshin.py b/genshin.py index 7e1b40e..36e1755 100755 --- a/genshin.py +++ b/genshin.py @@ -228,7 +228,7 @@ class Sign(object): status = '成功' messageList.append(self.message().format(today, self._regionNameList[i], uid, award['name'], award['cnt'], - totalSignDay, jdict['message'])) + totalSignDay, jdict['message'], '')) else: status = '失败' messageList = jdict From f6fc8c53d132393def6e7d9f28aba5cca8892c16 Mon Sep 17 00:00:00 2001 From: y1ndan Date: Fri, 1 Jan 2021 06:53:26 +0800 Subject: [PATCH 07/10] chore: upgrade pip before running --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 211031d..b4d709b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -37,6 +37,7 @@ jobs: - name: Run sign run: | + python -m pip install --upgrade pip pip install -r requirements.txt echo "${{ secrets.COOKIE }}" | tr '#' "\n" | sed 's/$/&#${{ secrets.SCKEY }}/g' | xargs -I {} sh -c 'echo "{}" | python3 ./genshin.py' From aafc2f681351bd69f43cca81241f5604f98f594a Mon Sep 17 00:00:00 2001 From: y1ndan Date: Fri, 1 Jan 2021 06:57:42 +0800 Subject: [PATCH 08/10] refactor: remove branch restriction --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b4d709b..944f063 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,7 +12,7 @@ env: jobs: build: runs-on: ubuntu-latest - if: github.ref == 'refs/heads/master' + # if: github.ref == 'refs/heads/master' steps: - name: Checkout master From 9b10a983721dac2b59c0eb333ba5292dd6aa5b7b Mon Sep 17 00:00:00 2001 From: y1ndan Date: Fri, 1 Jan 2021 11:08:24 +0800 Subject: [PATCH 09/10] refactor: update DS --- genshin.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/genshin.py b/genshin.py index 36e1755..3a147d9 100755 --- a/genshin.py +++ b/genshin.py @@ -44,12 +44,12 @@ class ConfMeta(type): @property def app_version(self): - return '2.2.1' + return '2.3.0' @property def ua(self): return 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_0_1 like Mac OS X) Apple' \ - 'WebKit/605.1.15 (KHTML, like Gecko) miHoYoBBS/2.2.0' + 'WebKit/605.1.15 (KHTML, like Gecko) miHoYoBBS/{}'.format(self.app_version) @property def act_id(self): @@ -127,15 +127,15 @@ class Sign(object): self.__class__, type(__name__), type(cookie))) self._cookie = cookie - # Provided by Steesha def md5(self, text): md5 = hashlib.md5() md5.update(text.encode()) return md5.hexdigest() def get_DS(self): - # n = self.md5(Conf.app_version) # V2.1.0 - n = 'cx2y9z9a29tfqvr1qsq6c7yz99b5jsqt' + # n = self.md5(2.1.0) # v2.1.0 @Steesha + # n = 'cx2y9z9a29tfqvr1qsq6c7yz99b5jsqt' # v2.2.0 @Womsxd + n = 'h8w582wxwgqvahcdkpvdhbh2w9casgfl' # v2.3.0 web @povsister & @journey-ad i = str(int(time.time())) r = ''.join(random.sample(string.ascii_lowercase + string.digits, 6)) c = self.md5('salt=' + n + '&t='+ i + '&r=' + r) From a00979ac74b183ee8df49eb740b9704c608a7569 Mon Sep 17 00:00:00 2001 From: y1ndan Date: Fri, 1 Jan 2021 12:50:23 +0800 Subject: [PATCH 10/10] style(main.yml): modify description --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 944f063..27d9925 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,7 +6,7 @@ on: workflow_dispatch: env: - # 是否允许从y1ndan/genshin-impact-helper同步代码 + # auto merge from y1ndan/genshin-impact-helper, default: false ALLOW_MERGE: 'false' jobs: @@ -21,7 +21,7 @@ jobs: fetch-depth: 0 ref: master - - name: Merge From y1ndan/genshin-impact-helper + - name: Auto merge if: ${{ env.ALLOW_MERGE != 'false' }} run: | git config --global user.name github-actions