mirror of
https://github.com/d0zingcat/RSSHub-python.git
synced 2026-05-17 23:16:51 +00:00
add type to infoq search query
This commit is contained in:
@@ -17,18 +17,18 @@ def parse(post):
|
||||
return item
|
||||
|
||||
|
||||
def ctx(category=''):
|
||||
def ctx(category='', type=''):
|
||||
# category = unquote(category, encoding='utf-8')
|
||||
category1 = category.encode("utf-8").decode("latin-1")
|
||||
referer = f'{domain}/search/c=0/k={category1}/t=0'
|
||||
referer = f'{domain}/search/c=0/k={category1}/t={type}'
|
||||
DEFAULT_HEADERS.update({'Referer': referer})
|
||||
url = f'{domain}/api/gksearch/search'
|
||||
payload = {"q":category,"t":0,"s":20,"p":1}
|
||||
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']
|
||||
return {
|
||||
'title': f'{category} - 搜索 - InfoQ',
|
||||
'link': referer,
|
||||
'link': f'{domain}/search/c=0/k={category}/t=0',
|
||||
'description': f'{category} - 极客邦搜索 - InfoQ',
|
||||
'author': 'hillerliao',
|
||||
'items': list(map(parse, posts))
|
||||
|
||||
Reference in New Issue
Block a user