├── .idea ├── hostloc_auto.iml ├── inspectionProfiles │ ├── Project_Default.xml │ └── profiles_settings.xml ├── misc.xml ├── modules.xml └── vcs.xml ├── README.md ├── Snapped.py ├── black_color_full.png ├── config.py ├── demo.png ├── demo1.png ├── discuz.py ├── info.log ├── login.py ├── logo.png └── requirements.txt /.idea/hostloc_auto.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 17 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # hostloc_auto 2 | loc机器人,全自动登录discuz论坛,签到,刷空间,回帖刷币 3 | 4 | 使用ChatGPT AI回帖。不容易被封号哦。 5 | 6 | V2.0 增加了多用户的支持以及多ChatGPT key的轮询。 7 | 8 | ## 9 | ```json 10 | {"role": "system", "content": "你是一个常年混迹hostloc的人,帮助回答一些问题."}, 11 | ``` 12 | prompt请修改一下,以避免你和别人的答案类似,不同的prompt会产生截然不同的回答。 13 | 14 | 2024年1月20日 兼容了第三方ChatGPT接口 15 | 16 | 17 | 2024年1月17日 修复了不能T楼的小bug 18 | 19 | 2023年11月13日 增加了T楼功能,多账号轮流T楼。mjj强大利器。 20 | 21 | ## 环境 22 | centos + python3.9 23 | 24 | ## 运行方式 25 | - 克隆仓库 26 | - discuz.py文件内修改论坛地址、账号、密码等信息 27 | 28 | ``` 29 | hostname = '' #论坛地址 30 | username = '' #账号 31 | password = '' #密码 32 | chatgpt_key = '' #ChatGPT的key 33 | ``` 34 | 35 | ```angular2html 36 | # credentials.py 37 | 38 | user_credentials = [ 39 | {'username': 'NodeLoc', 'password': 'Acbd1324!@#'}, 40 | # 添加更多的用户名和密码组合 41 | ] 42 | 43 | chatgpt_keys = [ 44 | 'chatgpt_key1', 45 | 'chatgpt_key2', 46 | # 添加更多的ChatGPT密钥 47 | ] 48 | #T楼主题ID 49 | auto_replay_tid = 12345 50 | #T楼次数 51 | auto_replay_times = 100 52 | #间隔时间(秒) 53 | auto_replay_interval = 500 54 | #T楼口号 55 | auto_replay_content = '绑定' 56 | #是否自动回帖,默认为否 57 | auto_replay = False 58 | ``` 59 | 60 | - 安装依赖,可以先直接运行 `python3 discuz.py`,缺哪个库装那个,直到日志(info.log)中显示登录成功的信息 61 | - crontab添加定时任务,每过6分钟执行一次回帖示例 `*/6 * * * * cd /root/discuz_bot/ && python3 discuz.py` 目录改成自己的 62 | 63 | ## 说明 64 | - 自动识别验证码登录 65 | - 先尝试无验证码登录一次,失败后尝试自动识别验证码登录 66 | - 针对Hostloc编写,如果是其它Discuz论坛修改一下基本也能用。 67 | 68 | ### Sponsor 69 | [![DartNode](black_color_full.png)](https://dartnode.com) 70 | -------------------------------------------------------------------------------- /Snapped.py: -------------------------------------------------------------------------------- 1 | import random 2 | import login 3 | import time 4 | import logging 5 | import re 6 | from random import randint 7 | from bs4 import BeautifulSoup 8 | import requests 9 | import sys 10 | import config 11 | 12 | logging.basicConfig(level=logging.INFO, filename='info.log', format="%(asctime)s %(filename)s %(funcName)s:line %(lineno)d %(levelname)s %(message)s") 13 | 14 | 15 | class Discuz: 16 | def __init__(self, hostname, username, password, chatgpt_key, questionid='0', answer=None, cookies_flag=True, pub_url=''): 17 | self.chatgpt_key = chatgpt_key 18 | self.hostname = hostname 19 | if pub_url != '': 20 | self.hostname = self.get_host(pub_url) 21 | 22 | self.discuz_login = login.Login(self.hostname, username, password, questionid, answer, cookies_flag) 23 | 24 | def login(self): 25 | self.discuz_login.main() 26 | self.session = self.discuz_login.session 27 | self.formhash = self.discuz_login.post_formhash 28 | 29 | def get_host(self, pub_url): 30 | res = requests.get(pub_url) 31 | res.encoding = "utf-8" 32 | url = re.search(r'a href="https://(.+?)/".+?>.+?入口', res.text) 33 | if url != None: 34 | url = url.group(1) 35 | logging.info(f'获取到最新的论坛地址:https://{url}') 36 | return url 37 | else: 38 | logging.error(f'获取失败,请检查发布页是否可用{pub_url}') 39 | return self.hostname 40 | 41 | def go_home(self): 42 | return self.session.get(f'https://{self.hostname}/forum.php').text 43 | 44 | def go_hot(self): 45 | return self.session.get(f'https://{self.hostname}/forum.php?mod=guide&view=new').text 46 | 47 | def get_reply_tid_list(self): 48 | tids = [] 49 | soup = BeautifulSoup(self.go_hot(), features="html.parser") 50 | replys = [] 51 | reply = soup.select_one('#threadlist') 52 | replys.append(reply) 53 | pattern = re.compile(r'thread-') 54 | for reply in replys: 55 | for a in reply.find_all("a", href=pattern): 56 | if '机器人' in str(a) or '通知' in str(a) or '封号' in str(a): 57 | continue 58 | url = a['href'] 59 | match = re.search(r'thread-(\d+)', url) 60 | if match: 61 | tids.append(match.group(1)) 62 | return tids 63 | 64 | def get_reply_tid(self): 65 | tids = self.get_reply_tid_list() 66 | if len(tids) > 0: 67 | return tids[randint(0, len(tids) - 1)] 68 | else: 69 | logging.error('tid获取失败,退出') 70 | sys.exit() 71 | 72 | 73 | 74 | def generate_random_numbers(self, start, end, count): 75 | random_numbers = [] 76 | for _ in range(count): 77 | random_number = random.randint(start, end) 78 | random_numbers.append(random_number) 79 | return random_numbers 80 | 81 | def signin(self): 82 | signin_url = f'https://{self.hostname}' 83 | self.session.get(signin_url) 84 | 85 | def visit_home(self): 86 | start = 1 # 起始数字 87 | end = 50000 # 结束数字 88 | count = 10 # 随机数字的数量 89 | 90 | random_numbers = self.generate_random_numbers(start, end, count) 91 | for number in random_numbers: 92 | time.sleep(5) 93 | signin_url = f'https://{self.hostname}/space-uid-{number}.html' 94 | self.session.get(signin_url) 95 | 96 | def reply(self, tid, message=''): 97 | reply_url = f'https://{self.hostname}/forum.php?mod=post&action=reply&tid={tid}&extra=&replysubmit=yes&infloat=yes&handlekey=fastpost&inajax=1' 98 | data = { 99 | 'file': '', 100 | 'message': config.auto_replay_content, 101 | 'posttime': int(time.time()), 102 | 'formhash': self.formhash, 103 | 'usesig': 1, 104 | 'subject': '', 105 | } 106 | 107 | res = self.session.post(reply_url, data=data).text 108 | if 'succeed' in res: 109 | url = re.search(r'succeedhandle_fastpost\(\'(.+?)\',', res).group(1) 110 | logging.info(f'T楼发送成功,tid:{tid},链接:{"https://" + self.hostname + "/" + url}') 111 | else: 112 | logging.error('T楼发送失败\t' + res) 113 | 114 | 115 | if __name__ == '__main__': 116 | looptimes = config.auto_replay_times 117 | # 循环执行每对用户名、密码和ChatGPT密钥的组合 118 | while looptimes>0: 119 | for credentials in config.user_credentials: 120 | hostname = 'hostloc.com' 121 | username = credentials['username'] 122 | password = credentials['password'] 123 | # 随机选择一个ChatGPT密钥 124 | chatgpt_key = random.choice(config.chatgpt_keys) 125 | discuz = Discuz(hostname, username, password, chatgpt_key) 126 | discuz.login() 127 | # 执行方法 128 | discuz.reply(config.auto_replay_tid) 129 | looptimes = looptimes-1 130 | time.sleep(config.auto_replay_interval) 131 | -------------------------------------------------------------------------------- /black_color_full.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nodeloc/hostloc_auto/9b58d38ae4b4ce5ee26b087d5ebc323e37bdadc6/black_color_full.png -------------------------------------------------------------------------------- /config.py: -------------------------------------------------------------------------------- 1 | # credentials.py 2 | 3 | user_credentials = [ 4 | {'username': 'username', 'password': '123456'}, 5 | # 添加更多的用户名和密码组合 6 | ] 7 | chatgpt_api_url = 'https://api.openai.com' 8 | chatgpt_model = 'gpt-3.5-turbo' 9 | chatgpt_prompt = '你是一个常年混迹hostloc的人,帮助回答一些问题.' 10 | 11 | chatgpt_keys = [ 12 | 'chatgpt_key1', 13 | 'chatgpt_key2', 14 | # 添加更多的ChatGPT密钥 15 | ] 16 | #T楼主题ID 17 | auto_replay_tid = 1264587 18 | #T楼次数 19 | auto_replay_times = 100 20 | #间隔时间(秒) 21 | auto_replay_interval = 500 22 | #T楼口号 23 | auto_replay_content = '绑定' 24 | #是否自动回帖,默认为否 25 | auto_replay = False -------------------------------------------------------------------------------- /demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nodeloc/hostloc_auto/9b58d38ae4b4ce5ee26b087d5ebc323e37bdadc6/demo.png -------------------------------------------------------------------------------- /demo1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nodeloc/hostloc_auto/9b58d38ae4b4ce5ee26b087d5ebc323e37bdadc6/demo1.png -------------------------------------------------------------------------------- /discuz.py: -------------------------------------------------------------------------------- 1 | import random 2 | import login 3 | import time 4 | import logging 5 | import re 6 | from random import randint 7 | from bs4 import BeautifulSoup 8 | import requests 9 | import sys 10 | import config 11 | 12 | logging.basicConfig(level=logging.INFO, filename='info.log', format="%(asctime)s %(filename)s %(funcName)s:line %(lineno)d %(levelname)s %(message)s") 13 | 14 | 15 | class Discuz: 16 | def __init__(self, hostname, username, password, chatgpt_key, questionid='0', answer=None, cookies_flag=True, pub_url=''): 17 | self.chatgpt_key = chatgpt_key 18 | self.hostname = hostname 19 | if pub_url != '': 20 | self.hostname = self.get_host(pub_url) 21 | 22 | self.discuz_login = login.Login(self.hostname, username, password, questionid, answer, cookies_flag) 23 | 24 | def login(self): 25 | self.discuz_login.main() 26 | self.session = self.discuz_login.session 27 | self.formhash = self.discuz_login.post_formhash 28 | 29 | def get_host(self, pub_url): 30 | res = requests.get(pub_url) 31 | res.encoding = "utf-8" 32 | url = re.search(r'a href="https://(.+?)/".+?>.+?入口', res.text) 33 | if url != None: 34 | url = url.group(1) 35 | logging.info(f'获取到最新的论坛地址:https://{url}') 36 | return url 37 | else: 38 | logging.error(f'获取失败,请检查发布页是否可用{pub_url}') 39 | return self.hostname 40 | 41 | def go_home(self): 42 | return self.session.get(f'https://{self.hostname}/forum.php').text 43 | 44 | def go_hot(self): 45 | return self.session.get(f'https://{self.hostname}/forum-45-1.html').text 46 | 47 | def get_reply_tid_list(self): 48 | tids = [] 49 | soup = BeautifulSoup(self.go_hot(), features="html.parser") 50 | replys = [] 51 | reply = soup.select_one('#threadlisttableid') 52 | replys.append(reply) 53 | pattern = re.compile(r'thread-') 54 | for reply in replys: 55 | for a in reply.find_all("a", href=pattern): 56 | if '机器人' in str(a) or '测试' in str(a) or '封号' in str(a): 57 | continue 58 | url = a['href'] 59 | match = re.search(r'thread-(\d+)', url) 60 | if match: 61 | tids.append(match.group(1)) 62 | return tids 63 | 64 | def get_reply_tid(self): 65 | tids = self.get_reply_tid_list() 66 | if len(tids) > 0: 67 | return tids[randint(0, len(tids) - 1)] 68 | else: 69 | logging.error('tid获取失败,退出') 70 | sys.exit() 71 | 72 | def chat_with_gpt(self, prompt): 73 | url = config.chatgpt_api_url + "/v1/chat/completions" 74 | headers = { 75 | "Content-Type": "application/json", 76 | "Authorization": "Bearer " + self.chatgpt_key, 77 | } 78 | data = { 79 | "model": config.chatgpt_model, 80 | "messages": [ 81 | {"role": "system", "content": config.chatgpt_prompt}, 82 | {"role": "user", "content": prompt} 83 | ], 84 | "max_tokens": 500, 85 | "temperature": 0.7 86 | } 87 | 88 | response = requests.post(url, headers=headers, json=data) 89 | response_json = response.json() 90 | print("chatgpt response -->" + str(response_json)) 91 | if "choices" in response_json: 92 | choices = response_json["choices"] 93 | if len(choices) > 0 and "message" in choices[0] and "content" in choices[0]["message"]: 94 | return choices[0]["message"]["content"] 95 | 96 | return None 97 | 98 | def generate_random_numbers(self, start, end, count): 99 | random_numbers = [] 100 | for _ in range(count): 101 | random_number = random.randint(start, end) 102 | random_numbers.append(random_number) 103 | return random_numbers 104 | 105 | def signin(self): 106 | signin_url = f'https://{self.hostname}' 107 | self.session.get(signin_url) 108 | 109 | def visit_home(self): 110 | start = 1 # 起始数字 111 | end = 50000 # 结束数字 112 | count = 10 # 随机数字的数量 113 | 114 | random_numbers = self.generate_random_numbers(start, end, count) 115 | for number in random_numbers: 116 | time.sleep(5) 117 | signin_url = f'https://{self.hostname}/space-uid-{number}.html' 118 | self.session.get(signin_url) 119 | 120 | def reply(self, tid, message=''): 121 | topic_url = f'https://{self.hostname}/thread-{tid}-1-1.html' 122 | res = self.session.get(topic_url).text 123 | prompt = "你好,请直接回复两句古诗" 124 | pattern = r'' 125 | match = re.search(pattern, res) 126 | if match: 127 | prompt = match.group(1) 128 | 129 | response = self.chat_with_gpt(prompt) 130 | if response: 131 | reply_url = f'https://{self.hostname}/forum.php?mod=post&action=reply&tid={tid}&extra=&replysubmit=yes&infloat=yes&handlekey=fastpost&inajax=1' 132 | data = { 133 | 'file': '', 134 | 'message': response, 135 | 'posttime': int(time.time()), 136 | 'formhash': self.formhash, 137 | 'usesig': 1, 138 | 'subject': '', 139 | } 140 | 141 | res = self.session.post(reply_url, data=data).text 142 | if 'succeed' in res: 143 | url = re.search(r'succeedhandle_fastpost\(\'(.+?)\',', res).group(1) 144 | logging.info(f'回复发送成功,tid:{tid},回复:{response},链接:{"https://" + self.hostname + "/" + url}') 145 | else: 146 | logging.error('回复发送失败\t' + res) 147 | else: 148 | logging.error('ChatGPT未能成功获取回复\t') 149 | 150 | 151 | if __name__ == '__main__': 152 | # 循环执行每对用户名、密码和ChatGPT密钥的组合 153 | for credentials in config.user_credentials: 154 | hostname = 'hostloc.com' 155 | username = credentials['username'] 156 | password = credentials['password'] 157 | # 随机选择一个ChatGPT密钥 158 | chatgpt_key = random.choice(config.chatgpt_keys) 159 | discuz = Discuz(hostname, username, password, chatgpt_key) 160 | discuz.login() 161 | discuz.signin() 162 | discuz.visit_home() 163 | if config.auto_replay: 164 | # 循环执行50次 165 | for i in range(50): 166 | # 执行方法 167 | discuz.reply(discuz.get_reply_tid()) 168 | # 等待5分钟 , 5分钟 = 5 * 60秒 = 300秒 169 | time.sleep(300) 170 | -------------------------------------------------------------------------------- /info.log: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nodeloc/hostloc_auto/9b58d38ae4b4ce5ee26b087d5ebc323e37bdadc6/info.log -------------------------------------------------------------------------------- /login.py: -------------------------------------------------------------------------------- 1 | import pickle 2 | from json import load 3 | from os import listdir 4 | import sys 5 | from time import time 6 | import logging 7 | import requests 8 | import ddddocr 9 | import re 10 | 11 | logging.basicConfig(level=logging.INFO,filename='info.log',format="%(asctime)s %(filename)s %(funcName)s:line %(lineno)d %(levelname)s %(message)s") 12 | 13 | 14 | 15 | class Login: 16 | def __init__(self, hostname, username, password, questionid='0', answer=None, cookies_flag=True): 17 | self.session = requests.session() 18 | self.session.headers.update({'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36'}) 19 | self.hostname = hostname 20 | self.username = str(username) 21 | self.password = str(password) 22 | 23 | self.questionid = questionid 24 | self.answer = answer 25 | self.cookies_flag = cookies_flag 26 | self.ocr = ddddocr.DdddOcr() 27 | 28 | 29 | def form_hash(self): 30 | rst = self.session.get(f'https://{self.hostname}/member.php?mod=logging&action=login').text 31 | logininfo = re.search(r'
', rst) 32 | if logininfo is not None: 33 | loginhash = re.search(r'
', rst).group(1) 34 | else: 35 | loginhash = "" 36 | formhash = re.search(r'', rst).group(1) 37 | logging.info(f'loginhash : {loginhash} , formhash : {formhash} ') 38 | return loginhash, formhash 39 | 40 | def verify_code_once(self): 41 | rst = self.session.get(f'https://{self.hostname}/misc.php?mod=seccode&action=update&idhash=cSA&0.3701502461393815&modid=member::logging').text 42 | update = re.search(r'update=(.+?)&idhash=', rst).group(1) 43 | 44 | code_headers = { 45 | 'Accept': 'image/webp,image/apng,image/*,*/*;q=0.8', 46 | 'Accept-Encoding': 'gzip, deflate, br', 47 | 'Accept-Language': 'zh-CN,zh;q=0.9', 48 | 'Connection': 'keep-alive', 49 | 'hostname': f'{self.hostname}', 50 | 'Referer': f'https://{self.hostname}/member.php?mod=logging&action=login', 51 | 'Sec-Fetch-Mode': 'no-cors', 52 | 'Sec-Fetch-Site': 'same-origin', 53 | 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36' 54 | } 55 | rst = self.session.get(f'https://{self.hostname}/misc.php?mod=seccode&update={update}&idhash=cSA', 56 | headers=code_headers) 57 | 58 | return self.ocr.classification(rst.content) 59 | 60 | 61 | def verify_code(self,num = 10): 62 | while num>0: 63 | num -=1 64 | code = self.verify_code_once() 65 | verify_url = f'https://{self.hostname}/misc.php?mod=seccode&action=check&inajax=1&modid=member::logging&idhash=cSA&secverify={code}' 66 | res = self.session.get(verify_url).text 67 | 68 | if 'succeed' in res: 69 | logging.info('验证码识别成功,验证码:'+code) 70 | return code 71 | else: 72 | logging.info('验证码识别失败,重新识别中...') 73 | 74 | logging.error('验证码获取失败,请增加验证次数或检查当前验证码识别功能是否正常') 75 | return '' 76 | 77 | def account_login_without_verify(self): 78 | 79 | loginhash, formhash = self.form_hash() 80 | login_url = f'https://{self.hostname}/member.php?mod=logging&action=login&loginsubmit=yes&loginhash={loginhash}&inajax=1' 81 | formData = { 82 | 'formhash': formhash, 83 | 'referer': f'https://{self.hostname}/', 84 | 'username': self.username, 85 | 'password': self.password, 86 | 'handlekey':'ls', 87 | } 88 | login_rst = self.session.post(login_url, data=formData).text 89 | if 'succeed' in login_rst: 90 | logging.info('登陆成功') 91 | return True 92 | else: 93 | logging.info('登陆失败,请检查账号或密码是否正确') 94 | return False 95 | 96 | 97 | 98 | def account_login(self): 99 | try: 100 | if self.account_login_without_verify(): 101 | return True 102 | except Exception: 103 | logging.error('存在验证码,登陆失败,准备获取验证码中', exc_info=True) 104 | 105 | code = self.verify_code() 106 | if code =='': 107 | return False 108 | 109 | loginhash, formhash = self.form_hash() 110 | login_url = f'https://{self.hostname}/member.php?mod=logging&action=login&loginsubmit=yes&loginhash={loginhash}&inajax=1' 111 | formData = { 112 | 'formhash': formhash, 113 | 'referer': f'https://{self.hostname}/', 114 | 'loginfield': self.username, 115 | 'username': self.username, 116 | 'password': self.password, 117 | 'questionid': self.questionid, 118 | 'answer': self.answer, 119 | 'cookietime': 2592000, 120 | 'seccodehash': 'cSA', 121 | 'seccodemodid': 'member::logging', 122 | 'seccodeverify': code, # verify code 123 | } 124 | login_rst = self.session.post(login_url, data=formData).text 125 | if 'succeed' in login_rst: 126 | logging.info('登陆成功') 127 | return True 128 | else: 129 | logging.info('登陆失败,请检查账号或密码是否正确') 130 | return False 131 | 132 | 133 | def cookies_login(self): 134 | cookies_name = 'COOKIES-' + self.username 135 | if cookies_name in listdir(): 136 | try: 137 | with open(cookies_name, 'rb') as f: 138 | self.session = pickle.load(f) 139 | response = self.session.get(f'https://{self.hostname}/home.php?mod=space').text 140 | 141 | if "退出" in response and "登录" not in response: 142 | logging.info('从文件中恢复Cookie成功,跳过登录。') 143 | return True 144 | except Exception: 145 | logging.warning('Cookie失效,使用账号密码登录。') 146 | else: 147 | logging.info('初次登录未发现Cookie,使用账号密码登录。') 148 | return False 149 | 150 | 151 | def go_home(self): 152 | return self.session.get(f'https://{self.hostname}/forum.php').text 153 | 154 | def get_conis(self): 155 | try: 156 | res = self.session.get(f'https://{self.hostname}/home.php?mod=spacecp&ac=credit&showcredit=1&inajax=1&ajaxtarget=extcreditmenu_menu').text 157 | coins = re.search(r'(.+?)', res).group(1) 158 | logging.info(f'当前金币数量:{coins}') 159 | except Exception: 160 | logging.error('获取金币数量失败!', exc_info=True) 161 | 162 | def main(self): 163 | 164 | try: 165 | if self.cookies_flag and self.cookies_login(): 166 | logging.info('成功使用cookies登录') 167 | else: 168 | self.account_login() 169 | res = self.go_home() 170 | self.post_formhash = re.search(r'', res).group(1) 171 | credit =re.search(r' class="showmenu">(.+?)', res).group(1) 172 | logging.info(f'{credit},提交文章formhash:{self.post_formhash}') 173 | 174 | self.get_conis() 175 | 176 | cookies_name = 'COOKIES-' + self.username 177 | with open(cookies_name, 'wb') as f: 178 | pickle.dump(self.session, f) 179 | logging.info('新的Cookie已保存。') 180 | 181 | except Exception: 182 | logging.error('失败,发生了一个错误!', exc_info=True) 183 | sys.exit() 184 | 185 | 186 | if __name__ == '__main__': 187 | login = Login('','','') 188 | login.main() 189 | -------------------------------------------------------------------------------- /logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nodeloc/hostloc_auto/9b58d38ae4b4ce5ee26b087d5ebc323e37bdadc6/logo.png -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | requests~=2.31.0 2 | ddddocr~=1.4.8 3 | beautifulsoup4~=4.12.2 --------------------------------------------------------------------------------