This commit is contained in:
jinql
2025-09-10 22:15:07 +08:00
parent 0adc1e717d
commit ce4135a809
2 changed files with 6 additions and 13 deletions

View File

@@ -125,6 +125,8 @@ async def get_icon_async(entity: Favicon, _cached: bytes = None) -> Optional[byt
lambda: ('', "网站默认位置/favicon.ico"),
# 4. 从其他api接口获取
lambda: (f'https://ico.kucat.cn/get.php?url={entity.get_base_url()}', "第三方API"),
# 99. 最后的尝试cloudflare workers
# lambda: (f'https://favicon.cary.cc/?url={entity.get_base_url()}', "cloudflare"),
]
for strategy in strategies:
@@ -193,8 +195,6 @@ def _parse_html(content: Optional[bytes], entity: Favicon) -> Optional[str]:
try:
# 尝试将bytes转换为字符串
# str(content).encode('utf-8', 'replace').decode('utf-8', 'replace')
# content_str = content.decode('utf-8', 'replace')
content_str = str(content).encode('utf-8', 'replace').decode('utf-8', 'replace')
# 使用更高效的解析器