更加兼容的解码方式

This commit is contained in:
Jing Ling
2020-01-23 00:29:54 +08:00
parent 6b3636ba3b
commit 67937a6313
+2 -2
View File
@@ -92,9 +92,9 @@ async def fetch(session, url):
proxy=config.get_proxy) as resp: proxy=config.get_proxy) as resp:
try: try:
text = await resp.text(encoding='gb2312') # 先尝试用fb2312解码 text = await resp.text(encoding='gb18030') # 先尝试用gb18030解码
except UnicodeDecodeError: except UnicodeDecodeError:
text = await resp.text(errors='ignore') text = await resp.text(encoding='utf-8', errors='ignore')
return resp, text return resp, text
except Exception as e: except Exception as e:
return e return e