mirror of
https://gitee.com/g1879/DrissionPage.git
synced 2024-12-10 04:00:23 +08:00
修复正则有些情况下获取不到charset的bug
This commit is contained in:
parent
3d04ab1405
commit
f1394d4cdd
@ -218,7 +218,7 @@ class SessionPage(object):
|
||||
else:
|
||||
headers = dict(r.headers)
|
||||
if 'Content-Type' not in headers or 'charset' not in headers['Content-Type']:
|
||||
re_result = re.search(r'<meta.*?charset=([^"\']+)', r.text)
|
||||
re_result = re.search(r'<meta.*?charset= *([^"\' />]+).*?>', r.text)
|
||||
try:
|
||||
charset = re_result.group(1)
|
||||
except:
|
||||
|
Loading…
x
Reference in New Issue
Block a user