简介
Tips:由于新浪的抄袭,小鸡词典目前斗争关停中......
小鸡词典
-API接口是由LoCCai
对小鸡词典网页进行抓包获取到的API接口。
开发背景
为了给七七添加梗查询功能,选择了小鸡词典作为数据网页。
当前使用API接口
排行榜:https://api.jikipedia.com/go/get_hot_search
梗查询:https://api.jikipedia.com/go/search_entities
抓包过程
排行榜
梗查询
步骤同上,只需要点击搜索框变为进行搜索即可
请求发送
排行榜
URL部分
url = "https://api.jikipedia.com/go/get_hot_search"
headers部分
header_text = {
'Accept': 'application/json, text/plain, */*',
'Content-Type': 'application/json;charset=UTF-8',
'Accept-Encoding': 'gzip, deflate, br',
'Referer': 'https://jikipedia.com/'
}
请求部分
resp = requests.post(url, headers=header_text)
resp = resp.text
梗查询
URL部分
url = "https://api.jikipedia.com/go/search_entities"
headers部分
headera_text={
'Accept': '*/*',
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh;q=0.9',
'Access-Control-Request-Headers': 'client,client-version,content-type,token,xid',
'Access-Control-Request-Method': 'POST',
'Connection': 'keep-alive',
'Host': 'api.jikipedia.com',
'Origin': 'https://jikipedia.com',
'Referer': 'https://jikipedia.com/',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'same-site',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36'
}
options部分
rea=requests.options(url,headers=headera_text)
print(rea.text)
headers部分
header_text = {
'Accept': 'application/json, text/plain, */*',
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh;q=0.9',
'Client': 'web',
'Client-Version': '2.7.2g',
'Content-Type': 'application/json;charset=UTF-8',
'Host': 'api.jikipedia.com',
'Origin': 'https://jikipedia.com',
'Referer': 'https://jikipedia.com/',
'sec-ch-ua':'" Not A;Brand";v="99", "Chromium";v="102", "Google Chrome";v="102"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"windows"',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'same-site',
'Token':'',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36',
'XID': '',
'Token':'账号token'
}
data部分
#待提交data格式
data_text = {
'page': 1,
'phrase': '待搜索string',
'size': 60
}
请求部分
data_text = json.dumps(data_text)
resp = requests.post(url, headers=header_text, data=data_text)
resp = resp.text
返回数据
两个请求返回的均为JSON,内容如下:
梗排行榜
{
"updated_at": "2022-06-17T10:46:28+08:00",
"data": [
{
"phrase": "雪糕侠",
"description": "克制雪糕刺客"
},
{
"phrase": "知识付费了四袋大米",
"description": "这才是知识付费"
},
{
"phrase": "分手表格",
"description": "恋爱精算师"
},
{
"phrase": "互联网嘴替",
"description": "说出心声"
},
{
"phrase": "文件夹已经建好了",
"description": "我的工作进度"
},
{
"phrase": "何猷君式发疯文学",
"description": "你对这个社会有贡献吗?"
},
{
"phrase": "章鱼哥的梦想",
"description": "也是我的"
},
{
"phrase": "不可能三角",
"description": "不可能满足这三项"
},
{
"phrase": "唐山大地震",
"description": "打人案的连锁反应"
},
{
"phrase": "友情脑",
"description": "也是我"
}
]
}
梗查询
{
"category": "received_options",
"information": "OK",
"message": {
"title": "OPTIONS",
"content": "收到了OPTIONS请求"
}
}
参考附件-[geng_dict.json][1]