mirror of
https://github.com/shmilylty/OneForAll.git
synced 2026-08-26 04:47:48 +08:00
解码兼容处理
This commit is contained in:
@@ -92,9 +92,9 @@ async def fetch(session, url):
|
||||
proxy=config.get_proxy) as resp:
|
||||
|
||||
try:
|
||||
text = await resp.text(encoding='gb18030') # 先尝试用gb18030解码
|
||||
except UnicodeDecodeError:
|
||||
text = await resp.text(encoding='utf-8', errors='ignore')
|
||||
text = await resp.text(encoding='utf-8', errors='replace') # 先尝试用utf-8解码
|
||||
except UnicodeError:
|
||||
text = await resp.text(encoding='gb18030', errors='replace')
|
||||
return resp, text
|
||||
except Exception as e:
|
||||
return e
|
||||
|
||||
Reference in New Issue
Block a user