├── README.md ├── cookie.json ├── config.json └── bbssign.py /README.md: -------------------------------------------------------------------------------- 1 | # MihoyoBBS-AutoSign 2 | 支持星穹铁道 3 | # 参考 4 | https://github.com/lingduzero666/MihoyoBBS-AutoSign 5 | -------------------------------------------------------------------------------- /cookie.json: -------------------------------------------------------------------------------- 1 | { 2 | "account_mid_v2": "", 3 | "ltoken": "", 4 | "ltuid": "", 5 | "cookie_token_v2": "" 6 | } 7 | -------------------------------------------------------------------------------- /config.json: -------------------------------------------------------------------------------- 1 | { 2 | "Cookie": "account_mid_v2=; ltoken=; ltuid=; cookie_token_v2=", 3 | 4 | "Delay": true, 5 | 6 | "Enable": { 7 | "BH2": true, 8 | "BH3": true, 9 | "SR": true, 10 | "YS": true, 11 | "BBS": true, 12 | "ChannelUpVote": true, 13 | "ChannelPublish": false, 14 | "DeleteOldPost": false 15 | }, 16 | 17 | "Game_BlackList": { 18 | "BH2": [""], 19 | "BH3": [""], 20 | "SR": [""], 21 | "YS": [""] 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /bbssign.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import requests 3 | import logging 4 | import random 5 | import time 6 | import hashlib 7 | import string 8 | import uuid 9 | import json 10 | import glob 11 | import os 12 | import sys 13 | 14 | #重要参数 15 | Salt_Sign = 'PVeGWIZACpxXZ1ibMVJPi9inCY4Nd4y2' #米游社签到salt 16 | Salt_BBS = 't0qEgfub6cvueAPgR5m9aQWWVciEer7v' #米游社讨论区专用salt 17 | mysVersion = "2.38.1" #米游社版本 18 | mysClient_type = '2' # 1:ios 2:Android 19 | 20 | #日志输出配置 21 | log = logger = logging 22 | logging.basicConfig( 23 | level=logging.INFO, 24 | format='%(asctime)s %(levelname)s %(message)s', 25 | datefmt='%Y-%m-%dT%H:%M:%S') 26 | 27 | #全局变量 28 | VERSION = "v1.0" 29 | IdentifyChar = "⨌" #删帖用的特殊识别符号 30 | PATH = os.path.dirname(os.path.realpath(__file__)) 31 | Multi_ConfigPath = PATH + "/MultiConfig/{}-config-{}.json" 32 | Multi_CookiePath = PATH + "/MultiConfig/{}-cookie.json" 33 | 34 | 35 | def LoadConfig(path=f"{PATH}/config.json"): 36 | '''加载配置文件''' 37 | with open(path, "r",encoding="utf-8") as f: 38 | data = json.load(f) 39 | f.close() 40 | return data 41 | 42 | def LoadCookie(path=f"{PATH}/cookie.json"): 43 | '''加载缓存的cookie文件''' 44 | with open(path, "r",encoding="utf-8") as f: 45 | data = json.load(f) 46 | f.close() 47 | return data 48 | 49 | def Write(login_ticket,stuid,stoken,path=f"{PATH}/cookie.json"): 50 | '''写入cookie缓存''' 51 | params = {"login_ticket": "{}".format(login_ticket), "stuid": "{}".format(stuid), "stoken": "{}".format(stoken)} 52 | with open(path, "w",encoding="utf-8") as r: 53 | json.dump(params,r) 54 | r.close() 55 | 56 | def Cleared(path=f"{PATH}/cookie.json"): 57 | '''清空缓存cookie''' 58 | if path != f"{PATH}/cookie.json": 59 | os.remove(path) 60 | else: 61 | params = {"login_ticket": "", "stuid": "", "stoken": ""} 62 | with open(path, "w",encoding="utf-8") as r: 63 | json.dump(params,r) 64 | r.close() 65 | 66 | def GameHeader(Referer="https://webstatic.mihoyo.com/"): #此referer为默认值 67 | '''游戏签到福利的header''' 68 | headers = { 69 | 'Cookie': Cookie, 70 | 'User-Agent': 'Mozilla/5.0 (Linux; Android 12; vivo-s7 Build/RKQ1.211119.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/105.0.5195.79 Mobile Safari/537.36 miHoYoBBS/2.38.1', 71 | 'Referer': Referer, 72 | 'DS': DS_BBS(), 73 | 'Accept': 'application/json, text/plain, */*', 74 | 'Accept-Encoding': 'gzip, deflate', 75 | 'Origin': 'https://webstatic.mihoyo.com', 76 | 'X-Requested-With': 'com.mihoyo.hyperion', 77 | 'x-rpc-device_id': str(uuid.uuid3(uuid.NAMESPACE_URL, Cookie)), 78 | 'x-rpc-device_name': 'vivo s7', 79 | 'x-rpc-device_model': 'vivo-s7', 80 | 'x-rpc-sys_version': '12', 81 | 'x-rpc-channel': 'vivo', 82 | 'x-rpc-client_type': mysClient_type, 83 | 'x-rpc-app_version': mysVersion 84 | } 85 | return headers 86 | 87 | def SleepTime(): 88 | '''随机延迟时间''' 89 | if delay : 90 | time.sleep(random.randint(5,10)) 91 | else: 92 | time.sleep(1) 93 | 94 | def md5(text): 95 | '''md5加密''' 96 | md5 = hashlib.md5() 97 | md5.update(text.encode()) 98 | return md5.hexdigest() 99 | 100 | def randomStr(n): 101 | '''生成指定位数的随机数''' 102 | return (''.join(random.sample(string.digits + string.ascii_letters, n))).lower() 103 | 104 | def DS_BBS(): 105 | '''生成米游社DS''' 106 | n = Salt_Sign 107 | i = str(int(time.time())) 108 | r = randomStr(6) 109 | c = md5("salt=" + n + "&t=" + i + "&r=" + r) 110 | return "{},{},{}".format(i, r, c) 111 | 112 | def DS_discuss(gid): 113 | '''生成讨论区DS''' 114 | n = Salt_BBS 115 | i = str(int(time.time())) 116 | r = str(random.randint(100001, 200000)) 117 | b = json.dumps({"gids": gid}) 118 | c = md5("salt=" + n + "&t=" + i + "&r=" + r + "&b=" + b + "&q=") #q值为空 119 | return "{},{},{}".format(i, r, c) 120 | 121 | def GetAllRoles(): 122 | '''获取账号的全部角色信息''' 123 | log.info('获取账号的全部角色信息中......') 124 | url = 'https://api-takumi.mihoyo.com/binding/api/getUserGameRolesByCookie' 125 | 126 | response = requests.get(url,headers=GameHeader()) 127 | data = json.loads(response.text.encode('utf-8')) 128 | if '登录失效,请重新登录' in data["message"]: 129 | log.warning(data) 130 | log.warning('Cookie已失效,请重新抓取Cookie') 131 | sys.exit() 132 | SleepTime() 133 | return data 134 | 135 | def CreateCookieCache(ConfigPath=f"{PATH}/config.json", CookiePath=f"{PATH}/cookie.json"): 136 | Cookie_url = "https://webapi.account.mihoyo.com/Api/cookie_accountinfo_by_loginticket?login_ticket={}" 137 | Cookie_url2 = "https://api-takumi.mihoyo.com/auth/api/getMultiTokenByLoginTicket?login_ticket={}&token_types=3&uid={}" 138 | 139 | log.info("更新Cookie数据中......") 140 | CookieCache = LoadConfig(ConfigPath) 141 | if "login_ticket" in CookieCache["Cookie"]: 142 | c = CookieCache["Cookie"].split(";") 143 | for i in c: 144 | if i.split("=")[0] == " login_ticket": #login_ticket前面的空格是必须的 145 | LoginTicket = i.split("=")[1] 146 | break 147 | response = requests.get(url=Cookie_url.format(LoginTicket)) #获取stuid 148 | data = json.loads(response.text.encode('utf-8')) 149 | if "成功" in data["data"]["msg"]: 150 | stuid = data["data"]["cookie_info"]["account_id"] 151 | response = requests.get(url=Cookie_url2.format(LoginTicket, stuid)) #获取stoken 152 | data = json.loads(response.text.encode('utf-8')) 153 | stoken = data["data"]["list"][0]["token"] 154 | Write(LoginTicket,stuid,stoken,CookiePath) 155 | log.info('更新成功') 156 | else: 157 | log.warning(data) 158 | log.warning('Cookie已失效,请重新抓取Cookie') 159 | Cleared(CookiePath) 160 | sys.exit() 161 | else: 162 | log.warning('Cookie中没有"login_ticket"数据,请重新抓取Cookie!') 163 | sys.exit() 164 | 165 | def Multi_Load(): 166 | '''多账号加载''' 167 | MultiPath = [] 168 | for m in range(len(glob.glob(Multi_ConfigPath.format("*","*")))): 169 | try:#从1开始轮询,避免顺序错误 170 | MultiPath.append(glob.glob(Multi_ConfigPath.format(m+1,"*"))[0]) 171 | except: 172 | break 173 | MultiCookie = glob.glob(Multi_CookiePath.format("*")) 174 | TotalConfig = len(MultiPath) 175 | TotalCookie = len(MultiCookie) 176 | 177 | Cookie_url = "https://webapi.account.mihoyo.com/Api/cookie_accountinfo_by_loginticket?login_ticket={}" 178 | Cookie_url2 = "https://api-takumi.mihoyo.com/auth/api/getMultiTokenByLoginTicket?login_ticket={}&token_types=3&uid={}" 179 | 180 | #获取备注信息 181 | MultiRemark = [] 182 | for r in MultiPath: 183 | MultiRemark.append(r.split("/")[-1].split("-")[-1].split(".")[0]) 184 | 185 | log.info('共找到 {} 个配置文件, {} 个缓存的Cookie数据'.format(TotalConfig,TotalCookie)) 186 | 187 | #获取没有缓存cookie的账号序号并创建cookie缓存 188 | ConfigOrdinal = [] 189 | for c1 in MultiPath: 190 | ConfigOrdinal.append(c1.split("/")[-1].split("-")[0]) 191 | CookieOrdinal = [] 192 | for c2 in MultiCookie: 193 | CookieOrdinal.append(c2.split("/")[-1].split("-")[0]) 194 | if TotalCookie != TotalConfig: 195 | for D in ConfigOrdinal: 196 | if D not in CookieOrdinal: 197 | d = int(D) 198 | log.info('正在为 [{}] 更新cookie数据......'.format(MultiRemark[d-1])) 199 | CreateCookieCache(ConfigPath=Multi_ConfigPath.format(d, MultiRemark[d-1]), CookiePath=Multi_CookiePath.format(d)) 200 | time.sleep(random.randint(2,5)) #写死休眠时间,防止触发风控 201 | return MultiPath,MultiRemark,TotalConfig 202 | class SR_Checkin(): 203 | 204 | #api 205 | Referer_url = 'https://webstatic.mihoyo.com/bbs/event/signin/hkrpg/index.html?bbs_auth_required=true&act_id={}&bbs_auth_required=true&bbs_presentation_style=fullscreen&utm_source=bbs&utm_medium=mys&utm_campaign=icon' 206 | Sign_url = 'https://api-takumi.mihoyo.com/event/luna/sign' #POST json 207 | Check_url = 'https://api-takumi.mihoyo.com/event/luna/info?act_id={}®ion={}&uid={}' 208 | 209 | #value 210 | Act_id = 'e202304121516551' 211 | Game_biz = 'hkrpg_cn' 212 | 213 | def sr_sign(self,region,uid): 214 | sign_data = { 215 | "act_id": self.Act_id, 216 | "region": region, 217 | "uid": uid 218 | } 219 | log.info('崩坏 星穹铁道: 正在为开拓者「{}」签到'.format(uid)) 220 | response = requests.post(url=self.Sign_url, headers=GameHeader(Referer=self.Referer_url.format(self.Act_id)), json=sign_data) 221 | data = json.loads(response.text.encode('utf-8')) 222 | SleepTime() 223 | return data 224 | 225 | def run(self,list): 226 | region = list["region"] 227 | uid = list["game_uid"] 228 | 229 | for i in range(3): 230 | sign_data = self.sr_sign(region,uid) #签到并返回数据 231 | try: 232 | #从专门的api检查签到结果 233 | response = requests.get(url=self.Check_url.format(self.Act_id,region,uid), headers=GameHeader()) 234 | data = json.loads(response.text.encode('utf-8')) 235 | if "OK" in sign_data["message"]: 236 | if data["data"]["is_sign"]: # "is_sign" 为布尔值 237 | log.info('崩坏 星穹铁道: 签到成功') 238 | break 239 | else: 240 | log.info('崩坏 星穹铁道: 第 {} 次请求成功但并未签上'.format(i + 1)) 241 | elif "已签到" in sign_data["message"]: 242 | log.info('崩坏 星穹铁道: 重复签到') 243 | break 244 | else: 245 | log.warning(sign_data) 246 | log.warning('崩坏 星穹铁道: 签到出现错误,请及时检查') 247 | break 248 | except: 249 | #直接输出签到api返回的签到结果 250 | log.warning(data) 251 | log.warning("未能从检查api得到签到结果,下面为签到api返回的结果,有概率漏签") 252 | if "OK" in sign_data["message"]: 253 | log.info('崩坏 星穹铁道: 签到成功') 254 | elif "开拓者,你已经签到过了" in sign_data["message"]: 255 | log.info('崩坏 星穹铁道: 重复签到') 256 | else: 257 | log.warning(sign_data) 258 | log.warning('崩坏 星穹铁道: 签到出现错误,请及时检查') 259 | break 260 | 261 | class BH2_Checkin(): 262 | 263 | #api 264 | Referer_url = 'https://webstatic.mihoyo.com/' 265 | Sign_url = 'https://api-takumi.mihoyo.com/event/luna/sign' #POST json 266 | Check_url = 'https://api-takumi.mihoyo.com/event/luna/info?lang=zh-cn&act_id={}®ion={}&uid={}' 267 | 268 | #value 269 | Act_id = 'e202203291431091' 270 | Game_biz = 'bh2_cn' 271 | 272 | def bh2_sign(self,region,uid): 273 | sign_data = { 274 | "act_id": self.Act_id, 275 | "region": region, 276 | "uid": uid, 277 | "lang": "zh-cn" 278 | } 279 | log.info('崩坏2: 正在为舰长「{}」签到'.format(uid)) 280 | response = requests.post(url=self.Sign_url, headers=GameHeader(Referer=self.Referer_url), json=sign_data) 281 | data = json.loads(response.text.encode('utf-8')) 282 | SleepTime() 283 | return data 284 | 285 | def run(self,list): 286 | region = list["region"] 287 | uid = list["game_uid"] 288 | 289 | for i in range(3): 290 | sign_data = self.bh2_sign(region,uid) #签到并返回数据 291 | try: 292 | #从专门的api检查签到结果 293 | response = requests.get(url=self.Check_url.format(self.Act_id,region,uid), headers=GameHeader()) 294 | data = json.loads(response.text.encode('utf-8')) 295 | if "OK" in sign_data["message"]: 296 | if data["data"]["is_sign"]: # "is_sign" 为布尔值 297 | log.info('崩坏2: 签到成功') 298 | break 299 | else: 300 | log.info('崩坏2: 第 {} 次请求成功但并未签上'.format(i + 1)) 301 | elif "已签到" in sign_data["message"]: 302 | log.info('崩坏2: 重复签到') 303 | break 304 | else: 305 | log.warning(sign_data) 306 | log.warning('崩坏2: 签到出现错误,请及时检查') 307 | break 308 | except: 309 | #直接输出签到api返回的签到结果 310 | log.warning(data) 311 | log.warning("未能从检查api得到签到结果,下面为签到api返回的结果,有概率漏签") 312 | if "OK" in sign_data["message"]: 313 | log.info('崩坏2: 签到成功') 314 | elif '已签到' in sign_data["message"]: 315 | log.info('崩坏2: 重复签到') 316 | else: 317 | log.warning(sign_data) 318 | log.warning('崩坏2: 签到出现错误,请及时检查') 319 | break 320 | 321 | class BH3_Checkin(): 322 | 323 | #api 324 | Referer_url = 'https://webstatic.mihoyo.com/bbs/event/signin/bh3/index.html?bbs_auth_required=true&act_id={}&bbs_presentation_style=fullscreen&utm_source=bbs&utm_medium=mys&utm_campaign=icon' 325 | Sign_url = 'https://api-takumi.mihoyo.com/event/luna/sign' #POST json 326 | Check_url = 'https://api-takumi.mihoyo.com/event/luna/info?lang=zh-cn&act_id={}®ion={}&uid={}' 327 | 328 | #value 329 | Act_id = 'e202207181446311' 330 | Game_biz = 'bh3_cn' 331 | 332 | def bh3_sign(self,region,uid): 333 | sign_data = { 334 | "act_id": self.Act_id, 335 | "region": region, 336 | "uid": uid, 337 | "lang": "zh-cn" 338 | } 339 | log.info('崩坏3: 正在为舰长「{}」签到'.format(uid)) 340 | response = requests.post(url=self.Sign_url, headers=GameHeader(Referer=self.Referer_url.format(self.Act_id)), json=sign_data) 341 | data = json.loads(response.text.encode('utf-8')) 342 | SleepTime() 343 | return data 344 | 345 | def run(self,list): 346 | region = list["region"] 347 | uid = list["game_uid"] 348 | 349 | for i in range(3): 350 | sign_data = self.bh3_sign(region,uid) #签到并返回数据 351 | try: 352 | #从专门的api检查签到结果 353 | response = requests.get(url=self.Check_url.format(self.Act_id,region,uid), headers=GameHeader()) 354 | data = json.loads(response.text.encode('utf-8')) 355 | if "OK" in sign_data["message"]: 356 | if data["data"]["is_sign"]: # "is_sign" 为布尔值 357 | log.info('崩坏3: 签到成功') 358 | break 359 | else: 360 | log.info('崩坏3: 第 {} 次请求成功但并未签上'.format(i + 1)) 361 | elif "已签到" in sign_data["message"]: 362 | log.info('崩坏3: 重复签到') 363 | break 364 | else: 365 | log.warning(sign_data) 366 | log.warning('崩坏3: 签到出现错误,请及时检查') 367 | break 368 | except: 369 | #直接输出签到api返回的签到结果 370 | log.warning(data) 371 | log.warning("未能从检查api得到签到结果,下面为签到api返回的结果,有概率漏签") 372 | if "OK" in sign_data["message"]: 373 | log.info('崩坏3: 签到成功') 374 | elif '已签到' in sign_data["message"]: 375 | log.info('崩坏3: 重复签到') 376 | else: 377 | log.warning(sign_data) 378 | log.warning('崩坏3: 签到出现错误,请及时检查') 379 | break 380 | 381 | class YS_Checkin(): 382 | 383 | #api 384 | Referer_url = 'https://webstatic.mihoyo.com/bbs/event/signin-ys/index.html?bbs_auth_required=true&act_id={}&utm_source=bbs&utm_medium=mys&utm_campaign=icon' 385 | Sign_url = 'https://api-takumi.mihoyo.com/event/bbs_sign_reward/sign' #POST json 386 | Check_url = 'https://api-takumi.mihoyo.com/event/bbs_sign_reward/info?act_id={}®ion={}&uid={}' 387 | 388 | #value 389 | Act_id = 'e202009291139501' 390 | Game_biz = 'hk4e_cn' 391 | 392 | def ys_sign(self,region,uid): 393 | sign_data = { 394 | "act_id": self.Act_id, 395 | "region": region, 396 | "uid": uid 397 | } 398 | log.info('原神: 正在为旅行者「{}」签到'.format(uid)) 399 | response = requests.post(url=self.Sign_url, headers=GameHeader(Referer=self.Referer_url.format(self.Act_id)), json=sign_data) 400 | data = json.loads(response.text.encode('utf-8')) 401 | SleepTime() 402 | return data 403 | 404 | def run(self,list): 405 | region = list["region"] 406 | uid = list["game_uid"] 407 | 408 | for i in range(3): 409 | sign_data = self.ys_sign(region,uid) #签到并返回数据 410 | try: 411 | #从专门的api检查签到结果 412 | response = requests.get(url=self.Check_url.format(self.Act_id,region,uid), headers=GameHeader()) 413 | data = json.loads(response.text.encode('utf-8')) 414 | if "OK" in sign_data["message"]: 415 | if data["data"]["is_sign"]: # "is_sign" 为布尔值 416 | log.info('原神: 签到成功') 417 | break 418 | else: 419 | log.info('原神: 第 {} 次请求成功但并未签上'.format(i + 1)) 420 | elif "旅行者,你已经签到过了" in sign_data["message"]: 421 | log.info('原神: 重复签到') 422 | break 423 | else: 424 | log.warning(sign_data) 425 | log.warning('原神: 签到出现错误,请及时检查') 426 | break 427 | except: 428 | #直接输出签到api返回的签到结果 429 | log.warning(data) 430 | log.warning("未能从检查api得到签到结果,下面为签到api返回的结果,有概率漏签") 431 | if "OK" in sign_data["message"]: 432 | log.info('原神: 签到成功') 433 | elif "旅行者,你已经签到过了" in sign_data["message"]: 434 | log.info('原神: 重复签到') 435 | else: 436 | log.warning(sign_data) 437 | log.warning('原神: 签到出现错误,请及时检查') 438 | break 439 | 440 | class MihoyoBBS(): 441 | #api 442 | Cookie_url = "https://webapi.account.mihoyo.com/Api/cookie_accountinfo_by_loginticket?login_ticket={}" 443 | Cookie_url2 = "https://api-takumi.mihoyo.com/auth/api/getMultiTokenByLoginTicket?login_ticket={}&token_types=3&uid={}" 444 | Sign_url = "https://bbs-api.mihoyo.com/apihub/app/api/signIn" # POST json 445 | List_url = "https://bbs-api.mihoyo.com/post/api/getForumPostList?forum_id={}&is_good=false&is_hot=false&page_size=20&sort_type=1" 446 | GetPostFull_url = "https://bbs-api.mihoyo.com/post/api/getPostFull?post_id={}" 447 | Share_url = "https://bbs-api.mihoyo.com/apihub/api/getShareConf?entity_id={}&entity_type=1" 448 | UpVote_url = "https://bbs-api.mihoyo.com/apihub/sapi/upvotePost" # POST json 449 | UserBusinesses_url = "https://bbs-api.mihoyo.com/user/api/getUserBusinesses?uid={}" #获取"我的频道"信息 450 | Missions_url = "https://bbs-api.mihoyo.com/apihub/api/getUserMissionsState?" #获取任务完成情况 451 | Draft_url = "https://bbs-api.mihoyo.com/post/api/draft/save" # POST json 草稿 452 | ReleasePost_url = "https://bbs-api.mihoyo.com/post/api/releasePost/v2" # POST json 发帖 453 | ReleaseReply_url = "https://bbs-api.mihoyo.com/post/api/releaseReply"# POST json 发评论 454 | SelfPostList_url = "https://bbs-api.mihoyo.com/painter/api/user_instant/list?offset={}&size=20&uid={}" #offset初始值为0 455 | DeletePost_url = "https://bbs-api.mihoyo.com/post/api/deletePost" # POST json 删帖 456 | 457 | #米游社分区 458 | BBS_List = [ 459 | { 460 | "id": "1", 461 | "forumId": "1", 462 | "name": "崩坏3", 463 | "url": "https://bbs.mihoyo.com/bh3/" 464 | }, 465 | { 466 | "id": "2", 467 | "forumId": "26", 468 | "name": "原神", 469 | "url": "https://bbs.mihoyo.com/ys/" 470 | }, 471 | { 472 | "id": "3", 473 | "forumId": "30", 474 | "name": "崩坏2", 475 | "url": "https://bbs.mihoyo.com/bh2/" 476 | }, 477 | { 478 | "id": "4", 479 | "forumId": "37", 480 | "name": "未定事件簿", 481 | "url": "https://bbs.mihoyo.com/wd/" 482 | }, 483 | { 484 | "id": "5", 485 | "forumId": "34", 486 | "name": "大别野", 487 | "url": "https://bbs.mihoyo.com/dby/" 488 | }, 489 | { 490 | "id": "6", 491 | "forumId": "52", 492 | "name": "星穹铁道", 493 | "url": "https://bbs.mihoyo.com/sr/" 494 | }, 495 | { 496 | "id": "8", 497 | "forumId": "57", 498 | "name": "绝区零", 499 | "url": "https://bbs.mihoyo.com/zzz/" 500 | } 501 | ] 502 | 503 | def __init__(self): 504 | self.LoginTicket = CookieCache["login_ticket"] 505 | self.stuid = CookieCache["stuid"] 506 | self.stoken = CookieCache["stoken"] 507 | 508 | self.CheckMission = True #检查任务完成情况 509 | 510 | if self.LoginTicket == "" or self.stuid == "" or self.stoken == "": 511 | CreateCookieCache() 512 | 513 | self.headers = { 514 | "Cookie": f'login_ticket={self.LoginTicket};stuid={self.stuid};stoken={self.stoken}', 515 | 'User-Agent': "okhttp/4.8.0", 516 | "DS": "", #随用随更新,保证实时性 517 | "x-rpc-client_type": mysClient_type, 518 | "x-rpc-app_version": mysVersion, 519 | "x-rpc-device_id": str(uuid.uuid3(uuid.NAMESPACE_URL, Cookie)), 520 | "x-rpc-device_name": "vivo s7", 521 | "x-rpc-device_model": "vivo-s7", 522 | "x-rpc-sys_version": "12", 523 | "x-rpc-channel": "miyousheluodi", 524 | "Accept-Encoding": "gzip", 525 | "Referer": "https://app.mihoyo.com", 526 | "Host": "bbs-api.mihoyo.com" 527 | } 528 | 529 | self.BBS_WhiteList = self.UserBusinesses()["data"]["businesses"] 530 | 531 | def UserBusinesses(self): 532 | log.info('获取米游社 “我的频道” 信息中......') 533 | self.headers["DS"] = DS_BBS() 534 | response = requests.get(url=self.UserBusinesses_url.format(self.stuid), headers=self.headers) 535 | data = json.loads(response.text.encode('utf-8')) 536 | if "OK" in data["message"]: 537 | SleepTime() 538 | return data 539 | elif "登录失效,请重新登录" in data["message"]: 540 | log.warning('Cookie已失效,请重新抓取Cookie') 541 | Cleared() 542 | else: 543 | log.warning(data) 544 | log.warning('获取账号 “我的频道” 信息失败,退出签到') 545 | sys.exit() 546 | 547 | def SignIn(self): 548 | log.info('讨论区签到中......') 549 | for i in self.BBS_List: 550 | if i["id"] in self.BBS_WhiteList: 551 | self.headers["DS"] = DS_discuss(gid=i["id"]) 552 | response = requests.post(url=self.Sign_url, headers=self.headers, json={"gids": i["id"]}) 553 | data = json.loads(response.text.encode('utf-8')) 554 | if "登录失效,请重新登录" not in data["message"]: 555 | log.info(i["name"] + ": " + data["message"]) 556 | SleepTime() 557 | else: 558 | log.warning(data) 559 | log.warning('签到失败,你的Cookie可能已过期,请重新抓取Cookie') 560 | Cleared() 561 | sys.exit() 562 | 563 | def Only_MYB(self): 564 | '''米游币任务''' 565 | List = [] 566 | #获取帖子列表 567 | self.headers["DS"] = DS_BBS() 568 | response = requests.get(url=self.List_url.format('26'), headers=self.headers) #获取的原神频道帖子 569 | data = json.loads(response.text.encode('utf-8')) 570 | #将获取到的帖子的id写入List 571 | PostSum = len(data["data"]["list"]) 572 | for n in range(PostSum): 573 | List.append(data["data"]["list"][n]["post"]["post_id"]) 574 | 575 | #看帖3篇 576 | Success = 0 577 | Count = 0 578 | log.info('浏览3篇帖子中......') 579 | while Success < 3 and Count < PostSum: 580 | self.headers["DS"] = DS_BBS() 581 | response = requests.get(url=self.GetPostFull_url.format(List[Count]), headers=self.headers) 582 | data = json.loads(response.text.encode('utf-8')) 583 | if "OK" in data["message"]: 584 | Count += 1 585 | elif "帖子不存在" in data["message"]: 586 | log.warning('帖子(ID:{})可能已被作者或管理员删除'.format(List[Count])) 587 | Count += 1 588 | else: 589 | log.warning(data) 590 | log.warning("浏览帖子出现问题,请及时检查") 591 | Count = 114514 #手动定义数值达到退出循环的效果 592 | #检查任务是否完成 593 | if Count >= 3 and self.CheckMission: 594 | try: 595 | response = requests.get(url=self.Missions_url + "point_sn=myb", headers=GameHeader()) #使用的是游戏签到header!!! 596 | data = json.loads(response.text.encode('utf-8')) 597 | for i in data["data"]["states"]: 598 | if i["mission_key"] == "view_post_0": #米游币每日任务-浏览3个帖子 599 | Success = i["happened_times"] 600 | break 601 | except: 602 | log.warning("检查任务是否完成失败,跳过检查") 603 | log.warning(data) 604 | self.CheckMission = False 605 | else: 606 | Success = Count 607 | SleepTime() 608 | else: 609 | if self.CheckMission: 610 | log.info("检查结果: 浏览成功 {} 篇".format(Success)) 611 | else: 612 | log.info('未能从检查api得到签到结果,有概率漏签') 613 | if Success < 3: 614 | if Count == 114514: 615 | Count = ' "( !!出现错误!! )" ' 616 | log.warning('尝试了{}篇帖子,浏览成功{}篇,未能完成任务'.format(Count,Success)) 617 | 618 | #点赞5篇 619 | Success = 0 620 | Count = 0 621 | log.info('点赞5篇帖子中......') 622 | while Success < 5 and Count < PostSum: 623 | self.headers["DS"] = DS_BBS() 624 | response = requests.post(url=self.UpVote_url, headers=self.headers,json={"post_id": List[Count], "is_cancel": False}) 625 | data = json.loads(response.text.encode('utf-8')) 626 | if "OK" in data["message"]: 627 | Count += 1 628 | elif "帖子不存在" in data["message"]: 629 | log.warning('帖子(ID:{})可能已被作者或管理员删除'.format(List[Count])) 630 | Count += 1 631 | else: 632 | log.warning(data) 633 | log.warning("点赞出现问题,请及时检查") 634 | Count = 114514 #手动定义数值达到退出循环的效果 635 | #检查任务是否完成 636 | if Count >= 5 and self.CheckMission: 637 | response = requests.get(url=self.Missions_url + "point_sn=myb", headers=GameHeader()) #使用的是游戏签到header!!! 638 | data = json.loads(response.text.encode('utf-8')) 639 | #上一步"看帖3篇"try过了 640 | for i in data["data"]["states"]: 641 | if i["mission_key"] == "post_up_0": #米游币每日任务-完成5次点赞 642 | Success = i["happened_times"] 643 | break 644 | else: 645 | Success = Count 646 | SleepTime() 647 | else: 648 | if self.CheckMission: 649 | log.info("检查结果: 点赞成功 {} 篇".format(Success)) 650 | else: 651 | log.info('未能从检查api得到签到结果,有概率漏签') 652 | if Success < 5: 653 | if Count == 114514: 654 | Count = ' "( !!出现错误!! )" ' 655 | log.warning('尝试了{}篇帖子,点赞成功{}篇,未能完成任务'.format(Count,Success)) 656 | 657 | #分享1篇 658 | Success = 0 659 | Count = 0 660 | log.info('分享1篇帖子中......') 661 | while Success < 1 and Count < PostSum: 662 | self.headers["DS"] = DS_BBS() 663 | response = requests.get(url=self.Share_url.format(List[Count]), headers=self.headers) 664 | data = json.loads(response.text.encode('utf-8')) 665 | if "OK" in data["message"]: 666 | Count += 1 667 | elif "帖子不存在" in data["message"]: 668 | log.warning('帖子(ID:{})可能已被作者或管理员删除'.format(List[Count])) 669 | Count += 1 670 | else: 671 | log.warning(data) 672 | log.warning("点赞出现问题,请及时检查") 673 | Count = 114514 #手动定义数值达到退出循环的效果 674 | #检查任务是否完成 675 | if Count >= 1 and self.CheckMission: 676 | response = requests.get(url=self.Missions_url + "point_sn=myb", headers=GameHeader()) #使用的是游戏签到header!!! 677 | data = json.loads(response.text.encode('utf-8')) 678 | #上上步"看帖3篇"try过了 679 | for i in data["data"]["states"]: 680 | if i["mission_key"] == "share_post_0": #米游币每日任务-分享帖子 681 | Success = i["happened_times"] 682 | break 683 | else: 684 | Success = Count 685 | SleepTime() 686 | else: 687 | if self.CheckMission: 688 | log.info("检查结果: 分享成功 {} 篇".format(Success)) 689 | else: 690 | log.info('未能从检查api得到签到结果,有概率漏签') 691 | if Success < 1: 692 | if Count == 114514: 693 | Count = ' !!出现错误!! ' 694 | log.warning('尝试了分享{}篇帖子,居然一篇都没有成功,未能完成任务'.format(Count)) 695 | 696 | def Channel_UpVote(self,channel): 697 | '''各频道点赞任务''' 698 | List = [] 699 | log.info("正在执行「{}」频道 “点赞10篇帖子” 任务......".format(channel["name"])) 700 | #获取该频道帖子列表 701 | self.headers["DS"] = DS_BBS() 702 | response = requests.get(url=self.List_url.format(channel["forumId"]), headers=self.headers) 703 | data = json.loads(response.text.encode('utf-8')) 704 | #将获取到的帖子的id写入List 705 | PostSum = len(data["data"]["list"]) 706 | for n in range(PostSum): 707 | List.append(data["data"]["list"][n]["post"]["post_id"]) 708 | 709 | #点赞10篇 710 | Success = 0 711 | Count = 0 712 | while Success < 10 and Count < PostSum: 713 | self.headers["DS"] = DS_BBS() 714 | response = requests.post(url=self.UpVote_url, headers=self.headers,json={"post_id": List[Count], "is_cancel": False}) 715 | data = json.loads(response.text.encode('utf-8')) 716 | if "OK" in data["message"]: 717 | Count += 1 718 | elif "帖子不存在" in data["message"]: 719 | log.warning('帖子(ID:{})可能已被作者或管理员删除'.format(List[Count])) 720 | Count += 1 721 | else: 722 | log.warning(data) 723 | log.warning("点赞出现问题,请及时检查") 724 | Count = 114514 #手动定义数值达到退出循环的效果 725 | #检查任务是否完成 726 | if Count >= 10 and self.CheckMission: 727 | try: 728 | response = requests.get(url=self.Missions_url + "gids={}".format(channel["id"]), headers=GameHeader()) #使用的是游戏签到header!!! 729 | data = json.loads(response.text.encode('utf-8')) 730 | for i in data["data"]["states"]: 731 | if i["mission_key"] == "post_up_{}".format(channel["id"]): 732 | Success = i["happened_times"] 733 | break 734 | except: 735 | log.warning("检查任务是否完成失败,跳过检查") 736 | self.CheckMission = False 737 | else: 738 | Success = Count 739 | SleepTime() 740 | else: 741 | if self.CheckMission: 742 | log.info("检查结果: 点赞成功 {} 篇".format(Success)) 743 | else: 744 | log.info('未能从检查api得到签到结果,有概率漏签') 745 | if Success < 10: 746 | if Count == 114514: 747 | Count = ' "( !!出现错误!! )" ' 748 | log.warning('尝试了{}篇帖子,点赞成功{}篇,未能完成任务'.format(Count,Success)) 749 | 750 | #以下为实验性功能 751 | #↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ 752 | def RandomElements(self): 753 | '''随机标题与内容''' 754 | SubjectList = ["水帖一篇","水水水","今日份的水帖","水帖得经验","随手一水","灌水灌水","欸嘿水一帖","每日任务之水帖"] 755 | ContentList = ["水帖不知道写啥","求点赞评论收藏","为了经验大家快来水帖呀","今日份的经验我来啦","水帖多多经验多多","愿早日升级"] 756 | Reply1List = ["我回我自己","发帖回复一条龙","为了经验必须回帖","今日份的经验get","水个回复","回复一下愿早日升级"] 757 | Reply2List = ["每日任务需要的回复","什么大伟出奇迹","飞鱼丸与包菜与应急食品","勤劳的孩子升级快","Ok经验到手","回复一下加快升级"] 758 | Subject = SubjectList[random.randint(0,len(SubjectList) - 1)] 759 | Content = ContentList[random.randint(0,len(ContentList) - 1)] 760 | Reply1 = Reply1List[random.randint(0,len(Reply1List) - 1)] 761 | Reply2 = Reply2List[random.randint(0,len(Reply2List) - 1)] 762 | return Subject,Content,Reply1,Reply2 763 | 764 | def Draft(self,subject,content,forumId,id): 765 | '''写入草稿''' 766 | draft_data = { 767 | "collection_id": 0, 768 | "content": "\u003cp\u003e" + content + "\u003c/p\u003e", 769 | "cover": "", 770 | "draft_id": "", 771 | "forum_cate_id": "", 772 | "forum_id": forumId, 773 | "gids": id, 774 | "is_original": 0, 775 | "is_profit": False, 776 | "link_card_list": [], 777 | "republish_authorization": 1, 778 | "structured_content": "[{\"insert\":\"" + content + "\\n\"}]", 779 | "subject": subject, 780 | "topic_ids": ["877"], #"每日一水"话题分区id 781 | "view_type": 1 782 | } 783 | count = 0 784 | while count < 3: 785 | self.headers["DS"] = DS_BBS() 786 | response = requests.post(url=self.Draft_url, headers=self.headers, json=draft_data) 787 | data = json.loads(response.text.encode('utf-8')) 788 | if data["retcode"] == 0: 789 | return(data["data"]["draft_id"]) 790 | elif data["retcode"] == -1: 791 | count += 1 792 | log.info('系统繁忙,1分钟后再次尝试') 793 | time.sleep(random.randint(55,65)) #写死休眠时间,防止触发风控 794 | else: 795 | log.warning(data) 796 | log.warning('写入草稿发生错误') 797 | return("err") 798 | else: 799 | log.warning(data) 800 | log.warning('写入草稿失败') 801 | return("err") 802 | 803 | def ReleasePost(self,subject,content,forumId,id,DraftId): 804 | '''发帖''' 805 | post_data = { 806 | "collection_id": 0, 807 | "content": "\u003cp\u003e" + content + "\u003c/p\u003e", 808 | "cover": "", 809 | "draft_id": DraftId, 810 | "forum_cate_id": "", 811 | "f_forum_id": forumId, 812 | "gids": id, 813 | "is_original": 0, 814 | "is_pre_publication": False, 815 | "is_profit": False, 816 | "post_id": "", 817 | "republish_authorization": 0, 818 | "structured_content": "[{\"insert\":\"" + content + "\\n\"}]", 819 | "subject": subject, 820 | "topic_ids": ["877"], #"每日一水"话题分区id 821 | "view_type": 1 822 | } 823 | count = 0 824 | while count < 3: 825 | self.headers["DS"] = DS_BBS() 826 | response = requests.post(url=self.ReleasePost_url, headers=self.headers, json=post_data) 827 | data = json.loads(response.text.encode('utf-8')) 828 | if data["retcode"] == 0: 829 | return(data["data"]["post_id"]) 830 | elif data["retcode"] == -1: 831 | count += 1 832 | log.info('系统繁忙,1分钟后再次尝试') 833 | time.sleep(random.randint(55,65)) #写死休眠时间,防止触发风控 834 | else: 835 | log.warning(data) 836 | log.warning('发帖发生错误') 837 | return("err") 838 | else: 839 | log.warning(data) 840 | log.warning('发帖失败') 841 | return("err") 842 | 843 | def ReleaseReply(self,PostId,reply): 844 | '''发评论''' 845 | reply_data = { 846 | "content": reply, 847 | "post_id": PostId, 848 | "reply_id": "", 849 | "structured_content": "[{\"insert\":\"" + reply + "\"}]" 850 | } 851 | count = 0 852 | while count < 3: 853 | self.headers["DS"] = DS_BBS() 854 | response = requests.post(url=self.ReleaseReply_url, headers=self.headers, json=reply_data) 855 | data = json.loads(response.text.encode('utf-8')) 856 | if data["retcode"] == 0: 857 | return data["message"] 858 | elif "帖子不存在" in data["message"]: 859 | log.warning('帖子不存在,无法评论') 860 | return("err") 861 | elif data["retcode"] == -1: #这条if未经验证,仅为推测,"帖子不存在"的retcode值也为-1 862 | count += 1 863 | log.info('系统繁忙,1分钟后再次尝试') 864 | time.sleep(random.randint(55,65)) #写死休眠时间,防止触发风控 865 | else: 866 | log.warning(data) 867 | log.warning('发评论发生错误') 868 | return("err") 869 | else: 870 | log.warning(data) 871 | log.warning('评论失败') 872 | return("err") 873 | 874 | def DeletePost(self): 875 | #获取需要删除的帖子 876 | SelfPost = [] 877 | offset,limit = 0,0 878 | last = False 879 | while last == False and limit < 5: 880 | limit += 1 881 | self.headers["DS"] = DS_BBS() 882 | response = requests.get(url=self.SelfPostList_url.format(offset,self.stuid), headers=self.headers) 883 | data = json.loads(response.text.encode('utf-8')) 884 | if data["retcode"] == 0: 885 | offset = data["data"]["next_offset"] 886 | last = data["data"]["is_last"] 887 | for list in data["data"]["list"]: 888 | PostSubject = list["post"]["post"]["subject"] 889 | #双重识别,避免误删 890 | if IdentifyChar in PostSubject: 891 | if PostSubject.split(IdentifyChar)[-1] == "(1/2)" or PostSubject.split(IdentifyChar)[-1] == "(2/2)": 892 | SelfPost.append(list["post"]["post"]["post_id"]) 893 | else: 894 | log.info(data) 895 | SleepTime() 896 | #开始删帖 897 | for id in SelfPost: 898 | delete_data = { 899 | "operate_type": 0, 900 | "post_id": id 901 | } 902 | self.headers["DS"] = DS_BBS() 903 | response = requests.post(url=self.DeletePost_url, headers=self.headers, json=delete_data) 904 | data = json.loads(response.text.encode('utf-8')) 905 | if data["retcode"] == 0: 906 | log.info('删除帖子(id:{}) 成功'.format(id)) 907 | else: 908 | log.info(data) 909 | SleepTime() 910 | 911 | def Channel_Publish(self,channel): 912 | '''执行各频道发帖&发评论任务''' 913 | for i in range(2): #发帖2篇 914 | subject,content,reply1,reply2 = self.RandomElements() 915 | subject += " {}({}/2)".format(IdentifyChar, i+1) 916 | 917 | #写入草稿 918 | DraftId = self.Draft(subject,content,channel["forumId"],channel["id"]) 919 | time.sleep(random.randint(12,15)) #写死休眠时间,防止触发风控 920 | 921 | #发帖子 922 | if DraftId == "err": 923 | return("err") 924 | else: 925 | PostId = self.ReleasePost(subject,content,channel["forumId"],channel["id"],DraftId) 926 | time.sleep(random.randint(20,30)) #写死休眠时间,防止触发风控 927 | 928 | #给每篇自己的帖子回复2次 929 | if PostId == "err": 930 | Reply1Data = "未发帖" 931 | Reply2Data = "未发帖" 932 | else: 933 | Reply1Data = self.ReleaseReply(PostId,reply1) 934 | time.sleep(random.randint(150,180)) #写死休眠时间,防止触发风控 935 | Reply2Data = self.ReleaseReply(PostId,reply2) 936 | 937 | #改为全角,保证对齐,强迫症直呼满足 938 | PerfectName = channel["name"] #传递给中间参数,避免修改源数据 939 | if PerfectName == "崩坏3": 940 | PerfectName = "崩坏3" 941 | elif PerfectName == "崩坏2": 942 | PerfectName = "崩坏2" 943 | elif PerfectName == "原神": 944 | PerfectName = "原 神" 945 | 946 | log.info('频道:{: <4}, 次数:{}, DraftID:{}, PostID:{}, 评论:{},{}'.format(PerfectName, i+1, DraftId, PostId, Reply1Data, Reply2Data)) 947 | time.sleep(random.randint(300,320)) #亲测发帖间隔5分钟以上较为安全不太会触发风控 948 | #↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ 949 | #以上为实验性功能 950 | 951 | def run(self): 952 | if Enable["BBS"]: 953 | log.info('开始执行米游币任务......') 954 | self.SignIn() #讨论区签到 955 | self.Only_MYB() #3次浏览,5次点赞,1次分享 956 | 957 | if Enable["ChannelUpVote"]: 958 | log.info('开始执行各频道点赞任务......') 959 | for channel in self.BBS_List: 960 | if channel["id"] in self.BBS_WhiteList: 961 | self.Channel_UpVote(channel) 962 | 963 | if Enable["DeleteOldPost"]: 964 | log.info('开始删除今天之前水的贴子') 965 | self.DeletePost() 966 | 967 | if Enable["ChannelPublish"]: 968 | log.info('开始执行各频道发帖&评论任务......') 969 | log.info('!!!作者亲测发帖间隔5分钟以上较为安全不太会触发风控,故完成本项任务需要巨长时间!!!') 970 | log.info('预估完成本项任务需要 {} 分钟,请一定要耐心等待'.format(len(self.BBS_WhiteList) * 2 * 8)) #乘数的第一个为每频道发帖次数,第二个为间隔时间 971 | for channel in self.BBS_List: 972 | if channel["id"] in self.BBS_WhiteList: 973 | result = self.Channel_Publish(channel) 974 | if result == "err": 975 | log.warning('退出执行各频道发帖&评论任务') 976 | break 977 | 978 | def StartRun(): 979 | if delay: 980 | log.info('已启用随机延迟,请耐心等待') 981 | 982 | #实验性功能警告 983 | if Enable["ChannelPublish"] or Enable["DeleteOldPost"]: 984 | log.info('!!!您已开启实验性功能,可能存在未知bug,且会有各种不可预估的风险(如禁言,封号),请酌情选择使用!!!') 985 | 986 | #游戏每日签到 987 | if Enable["BH2"] or Enable["BH3"] or Enable["YS"] or Enable["SR"]: 988 | for list in GetAllRoles()["data"]["list"]: 989 | if list["game_biz"] == "bh2_cn" and list["game_uid"] not in Game_BlackList["BH2"] and Enable["BH2"]: 990 | BH2_Checkin().run(list) #崩坏2每日签到 991 | if list["game_biz"] == "bh3_cn" and list["game_uid"] not in Game_BlackList["BH3"] and Enable["BH3"]: 992 | BH3_Checkin().run(list) #崩坏3福利补给 993 | if list["game_biz"] == "hkrpg_cn" and list["game_uid"] not in Game_BlackList["SR"] and Enable["SR"]: 994 | SR_Checkin().run(list) #崩坏 星穹铁道福利补给 995 | elif list["game_biz"] == "hk4e_cn" and list["game_uid"] not in Game_BlackList["YS"] and Enable["YS"]: 996 | YS_Checkin().run(list) #原神每日签到 997 | 998 | #米游社签到 999 | if Enable["BBS"] or Enable["ChannelUpVote"] or Enable["ChannelPublish"] or Enable["DeleteOldPost"]: 1000 | MihoyoBBS().run() 1001 | 1002 | 1003 | if __name__ == '__main__': 1004 | if "updata" in sys.argv: #手动更新cookie 1005 | log.info('请选择为哪个模式的config更新cookie(1:单账号 2:多账号)') 1006 | mode = int(input("请输入对应的数字:")) 1007 | if mode == 1: 1008 | CreateCookieCache() 1009 | elif mode == 2: 1010 | number = int(input('请输入多账号config文件的序号:')) 1011 | CreateCookieCache(ConfigPath=glob.glob(Multi_ConfigPath.format(number,"*"))[0], CookiePath=Multi_CookiePath.format(number)) 1012 | 1013 | elif "multi" in sys.argv: #多账号 1014 | log.info(f'欢迎使用 MihoyoBBS-AutoSign {VERSION} (多账号版)') 1015 | 1016 | #读取多账号配置 1017 | MultiPath,MultiRemark,TotalConfig = Multi_Load() 1018 | for n in range(TotalConfig): 1019 | log.info('{:=^46}'.format(f'正在执行第 {n+1} 个账号(备注信息:{MultiRemark[n]})')) 1020 | try: 1021 | config = LoadConfig(Multi_ConfigPath.format(n+1,MultiRemark[n])) 1022 | delay = config["Delay"] 1023 | Cookie = config["Cookie"] 1024 | Game_BlackList = config["Game_BlackList"] 1025 | Enable = config["Enable"] 1026 | CookieCache = LoadCookie(Multi_CookiePath.format(n+1)) 1027 | except: 1028 | log.warning('有配置信息未能读取,请检查配置文件是否有错误或是否为最新版') 1029 | sys.exit() 1030 | StartRun() 1031 | 1032 | else:#单账号 1033 | log.info(f'欢迎使用 MihoyoBBS-AutoSign {VERSION}') 1034 | 1035 | #读取配置文件 1036 | try: 1037 | config = LoadConfig() 1038 | delay = config["Delay"] 1039 | Cookie = config["Cookie"] 1040 | Game_BlackList = config["Game_BlackList"] 1041 | Enable = config["Enable"] 1042 | CookieCache = LoadCookie() 1043 | except: 1044 | log.warning('有配置信息未能读取,请检查配置文件是否有错误或是否为最新版') 1045 | sys.exit() 1046 | StartRun() 1047 | 1048 | log.info('任务全部完成\n') 1049 | --------------------------------------------------------------------------------