feat: more logs into the terminal

This commit is contained in:
草师傅 2025-08-04 14:35:40 +08:00
parent f591d546a5
commit ac67cdef7d
4 changed files with 27 additions and 7 deletions

View file

@ -1,3 +1,5 @@
import logging
import aiohttp
import re
import html
@ -181,6 +183,7 @@ def transform_into_fixed_url(url):
return url
async def process_url(url):
logging.debug('发现链接,正在尝试清理')
# 对于适配的网站,直接保留白名单参数并返回
if urlparse(url).hostname in whitelist_param_links:
final_url = reserve_whitelisted_params(url)
@ -232,4 +235,8 @@ async def handle_links(message: Message):
await message.reply(f"{"\n".join(final_urls)}\n消息里有包含跟踪参数的链接,已经帮你转换了哦~\n\n注意:"
f"这个功能是试验性的,可能会出现链接无法访问等问题,如果出现链接没有清理干净的情况,"
f"可以将返回的结果再次发送给bot或者尝试手动清理。\n如果你找到了这个工具的问题,欢迎"
f"把它通过 `/report_broken_links 链接 需要去除的参数等等` 报告给开发者!")
f"把它通过 `/report_broken_links 链接 需要去除的参数等等` 报告给开发者!")
else:
no_link_message = await message.reply("我没有发现可以处理的链接。\n此消息将会在 5 秒后被删除。", disable_web_page_preview=True)
await asyncio.sleep(5)
await no_link_message.delete()