diff --git a/README.md b/README.md index 64c05e9..e20d636 100644 --- a/README.md +++ b/README.md @@ -25,12 +25,16 @@ FullTClash名字来源于 Full Test base on Clash 。后端部分使用[Clash项 1. Netflix 2. Youtube 3. DisneyPlus -4. steam货币 +4. Bilibili解锁 5. OpenAI(ChatGPT) 6. 落地ip风险(IP欺诈度) 7. 维基百科 -8. TVBAnyware -9. Viu +8. 微软Copilot +9. Claude +10. 落地DNS区域检测 +11. Spotify +12. SSH 22端口封禁检测 +13. Tiktok 此外还有: @@ -152,7 +156,7 @@ pip install -r requirements.txt Windows系统名字后缀名.exe要加上,其他类Unix系统不需要加后缀名。 - 管理员配置(可选) - 从3.6.10版本开始,bot在首次启动时会将接收到的第一条消息的发送者作为管理员,一般无需手动配置,除非您想设置多个管理员: + 从3.6.11版本开始,bot在首次启动时会将接收到的第一条消息的发送者作为管理员,一般无需手动配置,除非您想设置多个管理员: ```yaml admin: - 12345678 # 改成自己的telegram uid diff --git a/addons/builtin/copilot.py b/addons/builtin/copilot.py index 613378b..f8ffd63 100644 --- a/addons/builtin/copilot.py +++ b/addons/builtin/copilot.py @@ -4,6 +4,7 @@ import aiohttp from loguru import logger +# 解锁判定方式;目前Copilot除了极少数地区未提供支持,其他的几乎都支持。和节点质量关系并不大。 UNS_REGION = ["MY", "CV", "CN", "CU", "SR", "TL", "IR", 'CI', 'KP', 'PS', 'RU', 'SH', 'SY'] try: from utils import retry @@ -31,7 +32,7 @@ async def fetch_copilot(collector, session: aiohttp.ClientSession, proxy=None): 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) ' 'Chrome/119.0.0.0 Safari/537.36 Edg/119.0.0.0' } - url = 'https://www.bing.com/search?q=bing' + url = 'https://www.bing.com/chat?toWww=1' async with session.get(url, headers=headers, proxy=proxy, timeout=5) as resp: if resp.history: for i in resp.history: @@ -40,8 +41,10 @@ async def fetch_copilot(collector, session: aiohttp.ClientSession, proxy=None): return True if resp.status == 200: text = await resp.text() - # index = text.find("Copilot") - index = text.find("b-scopeListItem-conv") + index = text.find("b_wlcmPersLogo.copilot") + # print("b_wlcmPersLogo.copilot:", index) + collector.info['copilot'] = str(index) + # return True try: region = re.search(r'Region:"(\w\w)"', text).group(1) # region2 = re.search(r'Region:"(.*)"', text).group(1) @@ -91,4 +94,6 @@ async def demo(): if __name__ == "__main__": - asyncio.run(demo()) + loop = asyncio.new_event_loop() + asyncio.set_event_loop(loop) + loop.run_until_complete(demo()) diff --git a/botmodule/command/authority.py b/botmodule/command/authority.py index 912e57f..2dd7945 100644 --- a/botmodule/command/authority.py +++ b/botmodule/command/authority.py @@ -42,7 +42,8 @@ 'slaveid': {}, # 记录后端id选择 } task_type = ['testurl', 'analyzeurl', 'speedurl'] -temp_queue = asyncio.Queue(maxsize=1) +# temp_queue = {} +QUEUE_MAP = {} def generate_random_string(length: int): @@ -123,6 +124,9 @@ async def get_url_from_invite(_, message2: "Message"): exclude_text = texts_li[2] url_li = geturl(text_li, True) if url_li: + temp_queue: Union[asyncio.Queue, None] = QUEUE_MAP.get(ID, None) + if temp_queue is None: + await message2.reply("❌此任务队列已被销毁,请重试") await temp_queue.put((url_li, include_text, exclude_text)) else: await message2.reply("无效的URL") @@ -176,24 +180,28 @@ async def invite_pass(client: Client, message: Message): return try: async with timeout(timeout_value): - suburl, in_text, ex_text = await temp_queue.get() + iq = asyncio.Queue(1) + QUEUE_MAP[start_uid] = iq + suburl, in_text, ex_text = await iq.get() except asyncio.TimeoutError: logger.info(f"验证过期: {key}") await bot_mes.edit_text("❌任务已取消\n\n原因: 接收订阅链接超时") + finally: + QUEUE_MAP.pop(start_uid, None) + INVITE_CACHE.pop(key, '') if suburl: from botmodule.bot import bot_put await message.reply("✨提交成功,请返回群组查看测试结果。") - await asyncio.sleep(3) + await asyncio.sleep(1) await bot_mes.delete() # await bot_put(app, originmsg, put_type, None, sort=sort_str, coreindex=1, slaveid=slaveid) - print( + logger.info( f"invite提交的任务项: {subtext[1]}\n测试项:{test_items}\n过滤器: {in_text}<->{ex_text}\n排序: {sort_str}\n" f"coreindex: {coreindex}\n后端id: {slaveid}") await bot_put(client, mes, subtext[1], test_items=test_items, include_text=in_text, exclude_text=ex_text, url=suburl, sort=sort_str, coreindex=coreindex, slaveid=slaveid) - else: - INVITE_CACHE.pop(key, '') + success_message_list.pop(start_uid, None) diff --git a/botmodule/command/setting.py b/botmodule/command/setting.py index 63ff64e..4cb55c0 100644 --- a/botmodule/command/setting.py +++ b/botmodule/command/setting.py @@ -433,8 +433,10 @@ async def select_slave_page(_: Client, call: Union[CallbackQuery, Message], cont if "default-slave" in slaveconfig: slaveconfig.pop("default-slave") usermsg = call.message.reply_to_message if isinstance(call, CallbackQuery) else call - user_ranking = get_slave_ranking(getID(usermsg)) - slaveconfig = get_ranked_slave_list(slaveconfig, user_ranking) + uconf = config.getUserconfig() + if "usage-ranking" in uconf and bool(uconf.get("usage-ranking", {}).get("enable", True)): + user_ranking = get_slave_ranking(getID(usermsg)) + slaveconfig = get_ranked_slave_list(slaveconfig, user_ranking) comment = [i.get('comment', None) for k, i in slaveconfig.items() if i.get('comment', None)] page = int(kwargs.get('page', 1)) diff --git a/botmodule/command/submanage.py b/botmodule/command/submanage.py index b986a3f..e1e8881 100644 --- a/botmodule/command/submanage.py +++ b/botmodule/command/submanage.py @@ -3,6 +3,9 @@ import pyrogram.types from pyrogram.errors import RPCError from loguru import logger +from pyrogram.types import Message +from pyrogram.enums import ParseMode + from utils import check, cleaner from botmodule.init_bot import config, admin from utils.check import check_user, get_telegram_id_from_message @@ -74,7 +77,7 @@ async def sub_invite(_, message: pyrogram.types.Message): # print(r) -async def sub(_, message): +async def sub(_, message: "Message"): ID = get_telegram_id_from_message(message) arg = cleaner.ArgCleaner().getall(str(message.text)) try: @@ -90,11 +93,11 @@ async def sub(_, message): subowner = subinfo.get('owner', '') if await check_user(message, admin, isalert=False): # 管理员至高权限 - await message.reply(str(subinfo.get('url', ''))) + await message.reply(str(subinfo.get('url', '')), parse_mode=ParseMode.DISABLED) return if subowner and subowner == ID: if hashlib.sha256(pwd.encode("utf-8")).hexdigest() == subpwd: - await message.reply(str(subinfo.get('url', ''))) + await message.reply(str(subinfo.get('url', '')), ) else: m2 = await message.reply("❌密码错误,请检查后重试") await asyncio.sleep(5) diff --git a/botmodule/subinfo.py b/botmodule/subinfo.py index 58a6107..e365bf9 100644 --- a/botmodule/subinfo.py +++ b/botmodule/subinfo.py @@ -4,17 +4,17 @@ from loguru import logger from pyrogram.enums import ParseMode from pyrogram.errors import RPCError -from utils.cleaner import geturl +from utils.cleaner import geturl, ArgCleaner from utils.collector import SubCollector from utils.check import get_telegram_id_from_message as get_id from utils.check import check_user +from utils import message_delete_queue as mdq from botmodule.init_bot import config, admin -from utils import cleaner async def getSubInfo(_, message): ID = get_id(message) - arg = cleaner.ArgCleaner().getall(str(message.text)) + arg = ArgCleaner.getarg(str(message.text)) call_time = time.strftime("%Y-%m-%dT%H:%M:%S", time.localtime()) try: back_message = await message.reply("正在查询流量信息...") # 发送提示 @@ -22,11 +22,11 @@ async def getSubInfo(_, message): url = geturl(text) arglen = len(arg) status = False + subname = arg[1] if not url: if arglen == 1: await back_message.edit_text("使用方法: /traffic & /subinfo & /流量查询 + <订阅链接> & <订阅名>") - await asyncio.sleep(5) - await back_message.delete() + mdq.put(back_message) return else: pwd = arg[2] if len(arg) > 2 else arg[1] @@ -54,38 +54,26 @@ async def getSubInfo(_, message): subcl = SubCollector(url) subcl.cvt_enable = False subinfo = await subcl.getSubTraffic() - if status: - if subinfo: - rs = subinfo[3] - subinfo[2] # 剩余流量 - subname = arg[1] - subinfo_text = f""" - ☁️订阅名称:{subname} + if not subinfo: + await back_message.edit_text("此订阅无法获取流量信息") + return + days_diff = subinfo[5] if len(subinfo) > 5 else "" + if days_diff: + days_diff = f"({days_diff}天)" + rs = subinfo[3] - subinfo[2] # 剩余流量 + subinfo_text = f""" ⬆️已用上行:{round(subinfo[0], 3)} GB ⬇️已用下行:{round(subinfo[1], 3)} GB 🚗总共使用:{round(subinfo[2], 3)} GB ⏳剩余流量:{round(rs, 3)} GB 💧总流量:{round(subinfo[3], 3)} GB -⏱️过期时间:{subinfo[4]} +⏱️过期时间:{subinfo[4]} {days_diff} 🔍查询时间:{call_time} - """ - await back_message.edit_text(subinfo_text, parse_mode=ParseMode.DISABLED) - else: - await back_message.edit_text("此订阅无法获取流量信息") + """ + if status: + subinfo_text = f"☁️订阅名称:{subname}" + subinfo_text else: - if subinfo: - rs = subinfo[3] - subinfo[2] # 剩余流量 - subinfo_text = f""" -☁️订阅链接:{url} -⬆️已用上行:{round(subinfo[0], 3)} GB -⬇️已用下行:{round(subinfo[1], 3)} GB -🚗总共使用:{round(subinfo[2], 3)} GB -⏳剩余流量:{round(rs, 3)} GB -💧总流量:{round(subinfo[3], 3)} GB -⏱️过期时间:{subinfo[4]} -🔍查询时间:{call_time} - """ - await back_message.edit_text(subinfo_text, parse_mode=ParseMode.DISABLED) - else: - await back_message.edit_text("此订阅无法获取流量信息") + subinfo_text = f"☁️订阅链接:{url}" + subinfo_text + await back_message.edit_text(subinfo_text, parse_mode=ParseMode.DISABLED) except RPCError as r: logger.error(str(r)) diff --git a/requirements.txt b/requirements.txt index dfc2a01..11f2d51 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ -aiohttp>=3.8.5 +aiohttp>=3.9.2 async_timeout>=4.0.2 -Pillow==10.1 +Pillow==10.2.0 pilmoji>=2.0.4 Pyrogram==2.0.106 PyYAML>=6.0 @@ -12,5 +12,5 @@ loguru>=0.6.0 aiohttp_socks>=0.8.4 tzlocal==4.1 geoip2==4.6.0 -cryptography==40.0.2 -google-re2==1.0 +cryptography==42.0.4 +google-re2>=1.0 diff --git a/resources/config.yaml.example b/resources/config.yaml.example index 6c50e12..5574bc7 100644 --- a/resources/config.yaml.example +++ b/resources/config.yaml.example @@ -1,11 +1,4 @@ # 注意,yaml配置文件对缩进敏感,请不要强迫症删掉#号之间的空格。 -admin: -- 12345678 #管理员,此处写你的账户id或用户名,必须配置该项,否则程序会自动退出 -clash: - path: './bin/FullTCore' # 代理客户端的路径,默认为 ./bin/ 下。下载地址: https://github.com/AirportR/FullTCore/releases -# allow-caching: false #是否缓存测试过程产生的订阅,若否,则测试完成后会自动删除测试订阅,以免造成空间浪费。(此配置暂不生效) -# core: 4 # 核心数,数量越多测试速度越快,但代价是内存会大量占用(每个核心大概10M),自己的机子多少内存自己平衡。默认值为1. -# branch: origin #clash内核上游分支,仅有两个有效值: [origin, meta], meta分支支持更多协议,比如vless、tuic等,但是使用上较为不可控,默认为origin原生内核。 bot: api_id: 123456 # Telegram的api_id api_hash: ABCDEFG # Telegram的api_hash @@ -21,6 +14,12 @@ bot: # bright: "]" #右括号自定义文本 # bspace: " " #空格自定义文本,默认为2个 # command: ['mycommand1', 'mycommand2'] #自定义指令,用于适配权限回调。高级用法,不会无需配置。 +#admin: +#- 12345678 #管理员,此处写你的账户id或用户名,必须配置该项,否则程序会自动退出 +#clash: +# path: './bin/FullTCore' # 代理客户端的路径,默认为 ./bin/ 下。下载地址: https://github.com/AirportR/FullTCore/releases +# core: 4 # 单批次中同时测试的节点数量,数量越多测试速度越快,但代价是运行内存会相应变大,自己的机子多少内存自己平衡。默认值为4. +# branch: origin #clash内核上游分支,仅有两个有效值: [origin, meta], meta分支支持更多协议,比如vless、tuic等,但是使用上较为不可控,默认为meta原生内核。 #以下是fulltclash的buildtoken,可以用默认的,但是安全性得不到保障,具体原因详见文档 #buildtoken: c7004ded9db897e538405c67e50e0ef0c3dbad717e67a92d02f6ebcfd1022a5ad1d2c4419541f538ff623051759ec000d2f426e03f9709a6608570c5b9141a6b #proxy: "host:端口" # http配置代理(非socks5),括号内可选用于下载获取订阅链接,订阅链接国内打不开可尝试开启(可选配置),本机提供的代理可以这样填: '127.0.0.1:7890' @@ -33,6 +32,7 @@ bot: # host: '127.0.0.1:25500' #域名或者ip加端口 # tls: false #是否启用了tls,决定拼接的转换地址URL前缀是http还是https,默认false # remoteconfig: "https://github.com/raw/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online.ini" #远程配置 +#ua: "ClashMetaForAndroid/2.8.9.Meta Mihomo/0.16 Clash.Meta" #获取订阅时请求UA(user-agent)覆写,此配置仅会影响获取订阅时的UA,默认值如当前所示。 #pingurl: http://www.gstatic.com/generate_204 #自定义延迟测试URL #netflixurl: "https://www.netflix.com/title/80113701" #自定义奈飞非自制剧检测网页,注意在更换此链接时请确保是非自制的链接。 #speedfile: #自定义测速文件,可以添加多个诸如以下格式或者[https://1.com, https://2.com] @@ -75,7 +75,8 @@ bot: # slaveid: local #slaveid的有效值参照配置里的 slaveconfig下的所有键。 # script: ["Netflix", "Youtube", "Disney+", "维基百科"] #script的有效值参照连通性测试绘图结果中显示的名称(大小写敏感)。 # sort: "HTTP升序" -# usage-ranking: #后端使用排行,这里记录者用户使用的后端次数,以便测试选择后端时把最常用的后端显示在第一页,这个配置是bot自动生成的,不用手动修改,你也不需要去管它。 +# usage-ranking: #后端使用排行,这里记录者用户使用的后端次数,以便测试选择后端时把最常用的后端显示在第一页。 +# enable: True #是否启用 # 查看你的机器人的所有可用测试项的python变量: # from utils.cleaner import addon # print(addon.global_test_item) diff --git a/utils/__init__.py b/utils/__init__.py index 3f00157..11bf1a3 100644 --- a/utils/__init__.py +++ b/utils/__init__.py @@ -5,14 +5,16 @@ from utils.cron import * from typing import Callable, Any, Union, Coroutine, Optional -__version__ = "3.6.11" # 项目版本号 +__version__ = "3.6.12" # 项目版本号 HOME_DIR = getcwd() +DEFAULT_UA = f"fulltclash/{__version__}" # 默认请求头 __all__ = [ "cron_delete_message", "cron_edit_message", "message_delete_queue", "message_edit_queue", "__version__", + "DEFAULT_UA", "retry", "script_demo", "HOME_DIR", @@ -90,7 +92,6 @@ def async_runtime(loop: Optional[asyncio.AbstractEventLoop] = None): """ 临时的异步运行时,适用于只有一两个异步函数的情况 :param: loop: 事件循环 - :param: break_func: 触发的回调中止函数,参数为调用函数的返回值,返回值为bool, """ if loop is None: loop = asyncio.new_event_loop() diff --git a/utils/backend.py b/utils/backend.py index 2893544..2e27de4 100644 --- a/utils/backend.py +++ b/utils/backend.py @@ -14,7 +14,7 @@ from loguru import logger from utils.collector import proxies from libs import pynat -from utils import message_edit_queue, cleaner, collector, ipstack, proxy, sorter, geoip +from utils import message_edit_queue, cleaner, collector, ipstack, proxy, sorter, geoip, __version__ # 重写整个测试核心,技术栈分离。 @@ -255,7 +255,7 @@ def nat_type_test(proxyaddr=None, proxyport=None): async def fetch(self: Speedtest, urls: list, host: str, port: int, buffer: int): try: async with aiohttp.ClientSession( - headers={"User-Agent": "FullTClash"}, + headers={"User-Agent": f"fulltclash/{__version__}"}, connector=ProxyConnector(host=host, port=port), ) as session: flag = 0 diff --git a/utils/cleaner.py b/utils/cleaner.py index dddfa60..4d85d35 100644 --- a/utils/cleaner.py +++ b/utils/cleaner.py @@ -785,6 +785,15 @@ def get_slave_ranking(self, ID: Union[str, int] = None): sorted_ranking = {item: c for item, c in sorted_ranking} return sorted_ranking + def get_ua(self): + """ + 获取自定义ua + """ + try: + return str(self.config['ua']) + except KeyError: + return "" + def getConcurrency(self) -> int: clashconf = self.config.get('clash', {}) max_workers = min(32, (os.cpu_count() or 1) + 14) diff --git a/utils/collector.py b/utils/collector.py index e9c3410..244a381 100644 --- a/utils/collector.py +++ b/utils/collector.py @@ -291,7 +291,7 @@ def __init__(self, suburl: str, include: str = '', exclude: str = '', force_conv """ super().__init__() self.text = None - self._headers = {'User-Agent': 'clash'} # 这个请求头是获取流量信息的关键 + self._headers = {'user-agent': 'ClashMetaForAndroid/2.8.9.Meta Mihomo/0.16 Clash.Meta'} # 这个请求头是获取流量信息的关键 self.subcvt_conf = config.config.get('subconverter', {}) self.cvt_enable = self.subcvt_conf.get('enable', False) self.url = suburl @@ -340,7 +340,7 @@ async def getSubTraffic(self, proxy=proxies): 获取订阅内的流量 :return: str """ - _headers = {'User-Agent': 'clash'} + _headers = config.get_ua() or {'user-agent': 'ClashMetaForAndroid/2.8.9.Meta Mihomo/0.16 Clash.Meta'} try: async with aiohttp.ClientSession(headers=_headers) as session: async with session.get(self.url, proxy=proxy, timeout=20) as response: @@ -358,10 +358,13 @@ async def getSubTraffic(self, proxy=proxies): traffic_download = info2.get('download', 0) / 1024 / 1024 / 1024 traffic_use = traffic_up + traffic_download traffic_total = info2.get('total', 0) / 1024 / 1024 / 1024 - expire_time = time.strftime("%Y-%m-%dT%H:%M:%S", time.localtime(info2.get('expire', time.time()))) + expire = info2.get('expire', time.time()) + days_diff = int((expire - time.time()) // (24 * 60 * 60)) + expire_time = time.strftime("%Y-%m-%dT%H:%M:%S", time.localtime(expire)) if expire_time.startswith('1970') and traffic_total and traffic_use: expire_time = '长期有效' - return [traffic_up, traffic_download, traffic_use, traffic_total, expire_time] + days_diff = 0 + return [traffic_up, traffic_download, traffic_use, traffic_total, expire_time, days_diff] except asyncio.exceptions.TimeoutError: logger.info("获取订阅超时") return [] @@ -377,7 +380,7 @@ async def getSubConfig(self, save_path: str = "./", proxy=proxies, inmemory: boo :param inmemory: 直接返回数据到内存,不保存到本地 :return: 获得一个文件: sub.yaml, bool : True or False """ - _headers = {'User-Agent': 'clash-meta'} + _headers = config.get_ua() or {'user-agent': 'ClashMetaForAndroid/2.8.9.Meta Mihomo/0.16 Clash.Meta'} # suburl = self.url suburl = self.cvt_url if self.cvt_enable else self.url cvt_text = "subconverter状态: {}".format("已启用" if self.cvt_enable else "未启用") diff --git a/utils/export.py b/utils/export.py index f282e1d..21c265a 100644 --- a/utils/export.py +++ b/utils/export.py @@ -1937,7 +1937,7 @@ def exportImage(self, debug: bool = False): end_colores = self.end_colores else: # 默认值 - colorvalues = ["#f5f3f2", "#beb1aa", "#f6bec8", "#dc6b82", "#c35c5d", "#8ba3c7", "#c8161d"] + colorvalues = ["#fae0e4", "#f7cad0", "#f9bec7", "#ff85a1", "#ff7096", "#ff5c8a", "#ff477e"] intervals = [0, 1, 5, 10, 20, 60, 100] alphaes = [255, 255, 255, 255, 255, 255, 255] end_colores = ["#f5f3f2", "#beb1aa", "#f6bec8", "#dc6b82", "#c35c5d", "#8ba3c7", "#c8161d"] @@ -2028,24 +2028,33 @@ def get_end_colors(_speedvalue, default_end_color='#C0C0C0'): end_color=end_color[7], alpha=alphas[7]) img.alpha_composite(block, (width, 60 * (t + 2))) if t1 == "平均速度" or t1 == "最大速度": - if "MB" in self.info[t1][t]: - speedvalue = float(self.info[t1][t][:-2]) - block = c_block_grad((info_list_length[i], speedblock_height), - color_value=get_color(speedvalue), end_color=get_end_colors(speedvalue), - alpha=get_alphas(speedvalue)) - img.alpha_composite(block, (width, speedblock_height * (t + 2))) - elif "KB" in self.info[t1][t] and float(self.info[t1][t][:-2]) > 0: - # speedvalue = float(self.info[t1][t][:-2]) + speedvalue = float(self.info[t1][t][:-2]) + block = None + if "KB" in self.info[t1][t] and float(self.info[t1][t][:-2]) > 0: block = c_block_grad((info_list_length[i], speedblock_height), color_value=get_color(1), end_color=get_end_colors(1), alpha=get_alphas(1)) - img.alpha_composite(block, (width, speedblock_height * (t + 2))) + elif "MB" in self.info[t1][t]: + pass + elif "GB" in self.info[t1][t]: + speedvalue *= pow(1024, 1) + elif "TB" in self.info[t1][t]: + speedvalue *= pow(1024, 2) + elif "PB" in self.info[t1][t]: + speedvalue *= pow(1024, 3) + elif "B" in self.info[t1][t]: + string = str(self.info[t1][t][-2]) + if len(string) > 1 and not string.isdigit(): + block = c_block_grad((info_list_length[i], speedblock_height), color_value=get_color(1), + end_color=get_end_colors(1), + alpha=get_alphas(1)) else: - speedvalue = float(self.info[t1][t][:-2]) + pass + if block is None: block = c_block_grad((info_list_length[i], speedblock_height), color_value=get_color(speedvalue), end_color=get_end_colors(speedvalue), alpha=get_alphas(speedvalue)) - img.alpha_composite(block, (width, speedblock_height * (t + 2))) + img.alpha_composite(block, (width, speedblock_height * (t + 2))) elif t1 == "每秒速度": speedblock_x = width for speedvalue in self.info[t1][t]: diff --git a/utils/ipstack.py b/utils/ipstack.py index 7cf11b7..7ee1874 100644 --- a/utils/ipstack.py +++ b/utils/ipstack.py @@ -30,7 +30,7 @@ async def get_ips(proxyhost: list, proxyport: list): length = min(len(proxyhost), len(proxyport)) for i in range(length): conn = ProxyConnector(host=proxyhost[i], port=proxyport[i], limit=0) - session = aiohttp.ClientSession(connector=conn, headers={'user-agent': 'FullTClash'}) + session = aiohttp.ClientSession(connector=conn, headers={'user-agent': 'fulltclash'}) session_pool.append(session) for j in range(length): tasks.append(asyncio.create_task(get_ip(v4url, session=session_pool[j]))) diff --git a/utils/myemoji.py b/utils/myemoji.py index a3033ad..e86b4d9 100644 --- a/utils/myemoji.py +++ b/utils/myemoji.py @@ -199,7 +199,7 @@ async def download_emoji(self, download_url: str = None, savepath='./resources/e _url = self.download_url if download_url is None else download_url # 如果没有提供下载地址则用默认的 print("Download URL:", _url) # 从网络上下载 - async with ClientSession(headers={'user-agent': 'FullTClash'}) as session: + async with ClientSession(headers={'user-agent': 'fulltclash'}) as session: async with session.get(_url, proxy=proxy) as resp: if resp.status == 200: content_leagth = resp.content_length if resp.content_length else 10 * 1024 * 1024