fix gansudaily econding bug
This commit is contained in:
parent
fb8ac287a9
commit
e2f0507e68
|
@ -97,11 +97,13 @@ def parse(url):
|
|||
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
|
||||
}
|
||||
r = requests.get(url, headers=headers)
|
||||
if r.encoding=='ISO-8859-1':
|
||||
print(r.encoding)
|
||||
|
||||
if t == 'xgs' and r.encoding=='ISO-8859-1':
|
||||
r.encoding='GBK'
|
||||
else:
|
||||
r.encoding = 'utf-8'
|
||||
# print(r.text)
|
||||
# way2@8797799
|
||||
selector = Selector(text=r.text)
|
||||
if t == 'weixin':
|
||||
og_title = selector.xpath(
|
||||
|
|
Loading…
Reference in New Issue