You've already forked favicon-api-async
25.09.10
This commit is contained in:
@@ -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')
|
||||
|
||||
# 使用更高效的解析器
|
||||
|
||||
Reference in New Issue
Block a user