try to fix chinsese char error in infoq search

This commit is contained in:
hillerliao
2022-10-22 10:15:34 +08:00
parent e9cb67d135
commit 27e7d2ee5f

View File

@@ -23,10 +23,10 @@ def ctx(category='', type=''):
referer = f'{domain}/search/c=0/k={category1}/t={type}'
DEFAULT_HEADERS.update({'Referer': referer})
url = f'{domain}/api/gksearch/search'
category = unquote(category, 'utf-8')
payload = {"q":category,"t": type,"s":20,"p":1}
posts = requests.post(url, json=payload, headers=DEFAULT_HEADERS)
posts = json.loads(posts.text)['data']['list']
category = unquote(category, 'utf-8')
return {
'title': f'{category} - 搜索 - InfoQ',
'link': f'{domain}/search/c=0/k={category}/t=0',