响应解码问题处理

This commit is contained in:
shmilylty
2019-08-13 17:35:28 +08:00
parent 3c065f56ae
commit 78832b4790
+5 -1
View File
@@ -65,7 +65,11 @@ async def fetch(session, url, semaphore):
allow_redirects=config.get_redirects,
timeout=timeout,
proxy=config.get_proxy) as resp:
text = await resp.text()
try:
text = await resp.text(encoding='gb2312') # 先尝试用fb2312解码
except UnicodeDecodeError:
text = await resp.text()
return resp, text