import{_ as o,c as p,b as s,a as l,d as a,e,w as c,r as D,o as r}from"./app-Dgsdh8A6.js";const i={};function d(u,n){const t=D("RouteLink");return r(),p("div",null,[n[2]||(n[2]=s("h1",{id:"默认搜索-热搜",tabindex:"-1"},[s("a",{class:"header-anchor",href:"#默认搜索-热搜"},[s("span",null,"默认搜索&热搜")])],-1)),n[3]||(n[3]=s("h2",{id:"获取默认搜索内容-web端",tabindex:"-1"},[s("a",{class:"header-anchor",href:"#获取默认搜索内容-web端"},[s("span",null,"获取默认搜索内容(web端)")])],-1)),n[4]||(n[4]=s("blockquote",null,[s("p",null,"https://api.bilibili.com/x/web-interface/wbi/search/default")],-1)),n[5]||(n[5]=s("blockquote",null,[s("p",null,[s("s",null,"https://api.bilibili.com/x/web-interface/search/default"),a(" (旧链接)")])],-1)),n[6]||(n[6]=s("p",null,[s("em",null,"请求方式:GET")],-1)),s("p",null,[n[1]||(n[1]=a("鉴权方式:")),e(t,{to:"/docs/misc/sign/wbi.html"},{default:c(()=>n[0]||(n[0]=[a("Wbi 签名")])),_:1,__:[0]})]),n[7]||(n[7]=l(`

默认搜索为搜索框中默认填充内容,用于官方推荐内容,若不输入点击搜索按钮跳转为url中的链接

json回复:

根对象:

字段类型内容备注
codenum返回值0:成功
messagestr错误信息默认为0
ttlnum1
dataobj信息本体

data对象:

字段类型内容备注
seidstr搜索seid
idnum默认搜索id
typenum0
show_namestr显示文字
namestr
goto_typenum跳转类型1:视频
goto_valuestr搜索目标id视频:稿件avid
urlstr搜索目标跳转url

示例:

curl 'https://api.bilibili.com/x/web-interface/search/default'
查看响应示例:
{
    "code": 0,
    "message": "0",
    "ttl": 1,
    "data": {
        "seid": "17607543598496143098",
        "id": 3296036255232726331,
        "type": 0,
        "show_name": "歪果仁在中国做模特能赚多少钱?",
        "name": "",
        "goto_type": 1,
        "goto_value": "243920322",
        "url": "https://www.bilibili.com/video/BV1Tv411q7gx"
    }
}

获取热搜列表

https://api.bilibili.com/x/web-interface/wbi/search/square https://api.bilibili.com/x/web-interface/search/square

请求方式: GET

URL参数:

参数名类型内容必要性备注
limitnum结果限制必要范围 [1, 50]
platformstr平台标识不必要web: web 端

JSON回复:

根对象:

字段类型内容备注
codenum返回值0: 成功
-400: 请求错误
messagestr错误信息默认为空
ttlnum1
dataobj数据本体

data对象:

字段类型内容备注
trendingobj热搜榜单套了个娃

data中的trending对象:

字段类型内容备注
titlestr标题
trackidstr跟踪 ID?
listarray热搜列表
top_listarray

trending中的list数组:

类型内容备注
0obj热搜 1
1obj热搜 2
……obj……
nobj热搜 (n+1)

list数组中的对象:

字段类型内容备注
keywordstr关键词
show_namestr显示文字
iconstr图标 URL
uristr
gotostr

示例:

获取热搜列表, 数量限制 4

curl -G --url 'https://api.bilibili.com/x/web-interface/search/square' \\
--url-query 'limit=4'
查看响应示例:
{
  "code": 0,
  "message": "0",
  "ttl": 1,
  "data": {
    "trending": {
      "title": "bilibili热搜",
      "trackid": "8079760748892487175",
      "list": [
        {
          "keyword": "马克龙祝贺中国世界前两名",
          "show_name": "马克龙祝贺中国世界前两名",
          "icon": "http://i0.hdslb.com/bfs/activity-plat/static/20221213/eaf2dd702d7cc14d8d9511190245d057/lrx9rnKo24.png",
          "uri": "",
          "goto": ""
        },
        {
          "keyword": "小孩电竞世界杯夺冠",
          "show_name": "小孩电竞世界杯夺冠",
          "icon": "http://i0.hdslb.com/bfs/activity-plat/static/20221213/eaf2dd702d7cc14d8d9511190245d057/lrx9rnKo24.png",
          "uri": "",
          "goto": ""
        },
        {
          "keyword": "孙颖莎说我全勤下班了",
          "show_name": "孙颖莎说我全勤下班了",
          "icon": "http://i0.hdslb.com/bfs/activity-plat/static/20221118/eaf2dd702d7cc14d8d9511190245d057/UF7B1wVKT2.png",
          "uri": "",
          "goto": ""
        },
        {
          "keyword": "7月广东新冠新增一万余例",
          "show_name": "7月广东新冠新增一万余例",
          "icon": "http://i0.hdslb.com/bfs/activity-plat/static/20221213/eaf2dd702d7cc14d8d9511190245d057/lrx9rnKo24.png",
          "uri": "",
          "goto": ""
        }
      ],
      "top_list": []
    }
  }
}

获取热搜列表(web端)

https://s.search.bilibili.com/main/hotword

请求方式:GET

榜单每隔固定时间统计一次,请求后返回搜索前10的关键词

带有转义

json回复:

根对象:

字段类型内容备注
exp_strstr???
codenum返回值0:成功
costobj详细搜索用时大概是吧?
seidstr搜索seid
timestampnum榜单统计时间时间戳
messagestr错误信息默认为success
listarray热搜列表

list数组:

类型内容备注
0obj榜单第1名
nobj榜单第(n+1)名按照名次顺序
10obj榜单第10名最后一项

list数组中的对象:

`,40)),n[8]||(n[8]=s("table",null,[s("thead",null,[s("tr",null,[s("th",null,"字段"),s("th",null,"类型"),s("th",null,"内容"),s("th",null,"备注")])]),s("tbody",null,[s("tr",null,[s("td",null,"status"),s("td",null,"str"),s("td",null,"空"),s("td")]),s("tr",null,[s("td",null,"hot_id"),s("td",null,"num"),s("td",null,"热词id"),s("td",null,"大概是吧?")]),s("tr",null,[s("td",null,"keyword"),s("td",null,"str"),s("td",null,"关键词"),s("td")]),s("tr",null,[s("td",null,"resource_id"),s("td",null,"num"),s("td",null,"资源id"),s("td")]),s("tr",null,[s("td",null,"goto_type"),s("td",null,"num"),s("td",null,"0"),s("td")]),s("tr",null,[s("td",null,"res"),s("td",null,"array"),s("td",null,"null"),s("td")]),s("tr",null,[s("td",null,"show_name"),s("td",null,"str"),s("td",null,"完整关键词"),s("td")]),s("tr",null,[s("td",null,"pos"),s("td",null,"num"),s("td",null,"名次"),s("td",null,"1-10")]),s("tr",null,[s("td",null,"word_type"),s("td",null,"num"),s("td",null,"条目属性"),s("td",null,[a("4: 新"),s("br"),a("5: 热"),s("br"),a("6: [雾,咒,小丑(愚人节)] 具体看icon"),s("b",{r:""}),a("7: 直播中"),s("br"),a("8: 默认(无标签)"),s("br"),a("9: 梗"),s("br"),a("11: 话题"),s("br"),a("12: 独家")])]),s("tr",null,[s("td",null,"id"),s("td",null,"num"),s("td",null,"名次"),s("td",null,"1-10")]),s("tr",null,[s("td",null,"goto_value"),s("td",null,"str"),s("td",null,"空"),s("td")]),s("tr",null,[s("td",null,"live_id"),s("td",null,"array"),s("td",null,"null"),s("td")]),s("tr",null,[s("td",null,"name_type"),s("td",null,"str"),s("td",null,"空"),s("td")]),s("tr",null,[s("td",null,"icon"),s("td",null,"str"),s("td",null,"图标url"),s("td")])])],-1)),n[9]||(n[9]=l(`

示例:

curl 'https://s.search.bilibili.com/main/hotword'
查看响应示例:
{
	"exp_str": "8104#8200#8300#8401#8500#5502#6699",
	"code": 0,
	"cost": {
		"reas_request": "0.001895",
		"params_check": "0.000127",
		"reas_response_format": "0.000098",
		"deserialize_response": "0.000080",
		"reas_request_format": "0.000076",
		"total": "0.002479",
		"main_handler": "0.002252"
	},
	"seid": "9318821020548476185",
	"timestamp": 1596034742,
	"message": "success",
	"list": [{
			"status": "",
			"hot_id": 11003,
			"keyword": "流浪地球2刘德华",
			"resource_id": 0,
			"goto_type": 0,
			"res": [

			],
			"show_name": "流浪地球2刘德华造型",
			"pos": 1,
			"word_type": 8,
			"id": 1,
			"goto_value": "",
			"live_id": [

			],
			"name_type": "",
			"icon": "http://i0.hdslb.com/bfs/feed-admin/e9e7a2d8497d4063421b685e72680bf1cfb99a0d.png"
		},
		{
			"status": "",
			"hot_id": 11012,
			"keyword": "QQ飞车手游飞跃黄河",
			"resource_id": 0,
			"goto_type": 0,
			"res": [

			],
			"show_name": "QQ飞车手游飞跃黄河",
			"pos": 2,
			"word_type": 8,
			"id": 2,
			"goto_value": "",
			"live_id": [

			],
			"name_type": "",
			"icon": "http://i0.hdslb.com/bfs/feed-admin/4d579fb61f9655316582db193118bba3a721eec0.png"
		},
		{
			"status": "",
			"hot_id": 10996,
			"keyword": "西工大遭网络攻击最新调查",
			"resource_id": 0,
			"goto_type": 0,
			"res": [

			],
			"show_name": "西工大遭网络攻击最新调查",
			"pos": 3,
			"word_type": 8,
			"id": 3,
			"goto_value": "",
			"live_id": [

			],
			"name_type": "",
			"icon": "http://i0.hdslb.com/bfs/feed-admin/e9e7a2d8497d4063421b685e72680bf1cfb99a0d.png"
		},
		{
			"status": "",
			"hot_id": 11004,
			"keyword": "EDG 起诉",
			"resource_id": 0,
			"goto_type": 0,
			"res": [

			],
			"show_name": "EDGJieJie已起诉多家企业",
			"pos": 4,
			"word_type": 8,
			"id": 4,
			"goto_value": "",
			"live_id": [

			],
			"name_type": "",
			"icon": "http://i0.hdslb.com/bfs/feed-admin/4d579fb61f9655316582db193118bba3a721eec0.png"
		},
		{
			"status": "",
			"hot_id": 10992,
			"keyword": "隐入尘烟",
			"resource_id": 0,
			"goto_type": 0,
			"res": [

			],
			"show_name": "隐入尘烟全平台下架",
			"pos": 5,
			"word_type": 8,
			"id": 5,
			"goto_value": "",
			"live_id": [

			],
			"name_type": "",
			"icon": "http://i0.hdslb.com/bfs/feed-admin/e9e7a2d8497d4063421b685e72680bf1cfb99a0d.png"
		},
		{
			"status": "",
			"hot_id": 10987,
			"keyword": "原神半年内最良心封神池",
			"resource_id": 0,
			"goto_type": 0,
			"res": [

			],
			"show_name": "原神半年内最良心封神池",
			"pos": 6,
			"word_type": 8,
			"id": 6,
			"goto_value": "",
			"live_id": [

			],
			"name_type": "",
			"icon": ""
		},
		{
			"status": "",
			"hot_id": 10988,
			"keyword": "高校回应设国内首个元宇宙院系",
			"resource_id": 0,
			"goto_type": 0,
			"res": [

			],
			"show_name": "高校回应设国内首个元宇宙院系",
			"pos": 7,
			"word_type": 8,
			"id": 7,
			"goto_value": "",
			"live_id": [

			],
			"name_type": "",
			"icon": ""
		},
		{
			"status": "",
			"hot_id": 10994,
			"keyword": "美宇宙飞船成功撞击小行星",
			"resource_id": 0,
			"goto_type": 0,
			"res": [

			],
			"show_name": "美宇宙飞船成功撞击小行星",
			"pos": 8,
			"word_type": 8,
			"id": 8,
			"goto_value": "",
			"live_id": [

			],
			"name_type": "",
			"icon": ""
		},
		{
			"status": "",
			"hot_id": 10991,
			"keyword": "你薅的羊毛可能已违法",
			"resource_id": 0,
			"goto_type": 0,
			"res": [

			],
			"show_name": "你薅的羊毛可能已违法",
			"pos": 9,
			"word_type": 8,
			"id": 9,
			"goto_value": "",
			"live_id": [

			],
			"name_type": "",
			"icon": ""
		},
		{
			"status": "",
			"hot_id": 11013,
			"keyword": "辛普森一家",
			"resource_id": 0,
			"goto_type": 0,
			"res": [

			],
			"show_name": "辛普森一家",
			"pos": 10,
			"word_type": 8,
			"id": 10,
			"goto_value": "",
			"live_id": [

			],
			"name_type": "",
			"icon": "http://i0.hdslb.com/bfs/feed-admin/4d579fb61f9655316582db193118bba3a721eec0.png"
		}
	]
}

获取热搜列表(手机端)

https://app.bilibili.com/x/v2/search/trending/ranking

请求方式:GET

榜单每隔固定时间统计一次

带有转义

url参数:

参数名类型内容必要性备注
limitnum热搜数量非必要留空为20, 最大为100

json回复:

根对象:

字段类型内容备注
codenum返回值0:成功
messagestr错误信息默认为0
ttlnum返回值默认为1

data对象:

字段类型内容备注
trackidnum不知用途
listarray热搜列表

list数组:

类型内容备注
0obj榜单第1名
nobj榜单第(n+1)名按照名次顺序
20/limitobj榜单第20名最后一项

list数组中的对象:

字段类型内容备注
positionnum名次1-20/limit
keywordstr关键词
show_namestr完整关键词
word_typenum条目属性同 web 端
iconstr图标url
hot_idnum热词id大概是吧?

示例:

curl 'https://app.bilibili.com/x/v2/search/trending/ranking'
查看响应示例:
{
	"code": 0,
	"message": "0",
	"ttl": 1,
	"data": {
		"trackid": "2578006123492681222",
		"list": [{
			"position": 1,
			"keyword": "列车延误乘务员哽咽安抚乘客",
			"show_name": "列车延误乘务员哽咽安抚乘客",
			"word_type": 5,
			"icon": "http://i0.hdslb.com/bfs/activity-plat/static/20221213/eaf2dd702d7cc14d8d9511190245d057/lrx9rnKo24.png",
			"hot_id": 107814,
			"is_commercial": "0"
		}, {
			"position": 2,
			"keyword": "黑神话悟空首次线下试玩",
			"show_name": "黑神话悟空首次线下试玩",
			"word_type": 5,
			"icon": "http://i0.hdslb.com/bfs/activity-plat/static/20221213/eaf2dd702d7cc14d8d9511190245d057/lrx9rnKo24.png",
			"hot_id": 107781,
			"is_commercial": "0"
		}, {
			"position": 3,
			"keyword": "22万人打出9.9分的动画",
			"show_name": "22万人打出9.9分的动画",
			"word_type": 6,
			"icon": "https://i0.hdslb.com/bfs/legacy/463fa23613670218608e68247a137dd071c0e9c8.png",
			"hot_id": 107818,
			"is_commercial": "0"
		}, {
			"position": 4,
			"keyword": "冰冻近五万年线虫被复活",
			"show_name": "冰冻近五万年线虫被复活",
			"word_type": 5,
			"icon": "http://i0.hdslb.com/bfs/activity-plat/static/20221213/eaf2dd702d7cc14d8d9511190245d057/lrx9rnKo24.png",
			"hot_id": 107774,
			"is_commercial": "0"
		}, {
			"position": 5,
			"keyword": "LNG前任和现任的较量",
			"show_name": "LNG前任和现任的较量",
			"word_type": 4,
			"icon": "http://i0.hdslb.com/bfs/activity-plat/static/20221118/eaf2dd702d7cc14d8d9511190245d057/UF7B1wVKT2.png",
			"hot_id": 107853,
			"is_commercial": "0"
		}, {
			"position": 6,
			"keyword": "LOL手游剑姬女警新皮",
			"show_name": "LOL手游剑姬女警新皮",
			"word_type": 8,
			"hot_id": 107841,
			"is_commercial": "0"
		}, {
			"position": 7,
			"keyword": "抽奖中金条却因过号被取消",
			"show_name": "抽奖中金条却因过号被取消",
			"word_type": 8,
			"hot_id": 107817,
			"is_commercial": "0"
		}, {
			"position": 8,
			"keyword": "雪王到长城开蜜雪冰城",
			"show_name": "雪王到长城开蜜雪冰城",
			"word_type": 4,
			"icon": "http://i0.hdslb.com/bfs/activity-plat/static/20221118/eaf2dd702d7cc14d8d9511190245d057/UF7B1wVKT2.png",
			"hot_id": 107849,
			"is_commercial": "0"
		}, {
			"position": 9,
			"keyword": "堡垒之夜联动终结者",
			"show_name": "堡垒之夜联动终结者",
			"word_type": 8,
			"hot_id": 107846,
			"is_commercial": "0"
		}, {
			"position": 10,
			"keyword": "王者新英雄海诺动画",
			"show_name": "王者新英雄海诺动画",
			"word_type": 4,
			"icon": "http://i0.hdslb.com/bfs/activity-plat/static/20221118/eaf2dd702d7cc14d8d9511190245d057/UF7B1wVKT2.png",
			"hot_id": 107870,
			"is_commercial": "0"
		}, {
			"position": 11,
			"keyword": "周星驰功夫10万字拆解",
			"show_name": "周星驰功夫10万字拆解",
			"word_type": 4,
			"icon": "http://i0.hdslb.com/bfs/activity-plat/static/20221118/eaf2dd702d7cc14d8d9511190245d057/UF7B1wVKT2.png",
			"hot_id": 107848,
			"is_commercial": "0"
		}, {
			"position": 12,
			"keyword": "张杰铁粉彭奶奶去世",
			"show_name": "张杰铁粉彭奶奶去世",
			"word_type": 4,
			"icon": "http://i0.hdslb.com/bfs/activity-plat/static/20221118/eaf2dd702d7cc14d8d9511190245d057/UF7B1wVKT2.png",
			"hot_id": 107840,
			"is_commercial": "0"
		}, {
			"position": 13,
			"keyword": "李玟二姐回应礼服争议",
			"show_name": "李玟二姐回应礼服争议",
			"word_type": 8,
			"hot_id": 107833,
			"is_commercial": "0"
		}, {
			"position": 14,
			"keyword": "洪水中飘来冰箱市民取走饮料",
			"show_name": "洪水中飘来冰箱市民取走饮料",
			"word_type": 8,
			"hot_id": 107802,
			"is_commercial": "0"
		}, {
			"position": 15,
			"keyword": "LOL斗魂觉醒佛耶戈语音",
			"show_name": "LOL斗魂觉醒佛耶戈语音",
			"word_type": 8,
			"hot_id": 107790,
			"is_commercial": "0"
		}, {
			"position": 16,
			"keyword": "全面落实带薪休假制度",
			"show_name": "全面落实带薪休假制度",
			"word_type": 4,
			"icon": "http://i0.hdslb.com/bfs/activity-plat/static/20221118/eaf2dd702d7cc14d8d9511190245d057/UF7B1wVKT2.png",
			"hot_id": 107839,
			"is_commercial": "0"
		}, {
			"position": 17,
			"keyword": "花少北 把病娇治好了",
			"show_name": "花少北 把病娇治好了",
			"word_type": 8,
			"hot_id": 107782,
			"is_commercial": "0"
		}, {
			"position": 18,
			"keyword": "2.28米高的村超娃",
			"show_name": "2.28米高的村超娃",
			"word_type": 8,
			"hot_id": 107805,
			"is_commercial": "0"
		}, {
			"position": 19,
			"keyword": "当在动漫中不小心撞到",
			"show_name": "当在动漫中不小心撞到",
			"word_type": 8,
			"hot_id": 107832,
			"is_commercial": "0"
		}, {
			"position": 20,
			"keyword": "台风卡努路径趋向日本",
			"show_name": "台风卡努路径趋向日本",
			"word_type": 8,
			"hot_id": 107800,
			"is_commercial": "0"
		}],
		"exp_str": "8000#5508#6604#7703",
		"hotword_egg_info": "0"
	}
}
`,22))])}const q=o(i,[["render",d]]),C=JSON.parse('{"path":"/docs/search/hot.html","title":"默认搜索&热搜","lang":"zh-CN","frontmatter":{},"git":{"updatedTime":1742747782000,"contributors":[{"name":"SocialSisterYi","username":"SocialSisterYi","email":"1440239038@qq.com","commits":2,"url":"https://github.com/SocialSisterYi"},{"name":"eya46","username":"eya46","email":"61458340+eya46@users.noreply.github.com","commits":1,"url":"https://github.com/eya46"},{"name":"LaMerChiang","username":"LaMerChiang","email":"catlair@qq.com","commits":1,"url":"https://github.com/LaMerChiang"},{"name":"SessionHu","username":"SessionHu","email":"102411014+SessionHu@users.noreply.github.com","commits":2,"url":"https://github.com/SessionHu"}],"changelog":[{"hash":"a9f405a9a06964bfc715b17806a09334a110a96c","time":1742747782000,"email":"102411014+SessionHu@users.noreply.github.com","author":"SessionHu","message":"feat(search/hot): wbi/search/square"},{"hash":"60a0c5d1a2f44fe61335da04571305fa7727a968","time":1724238159000,"email":"102411014+SessionHu@users.noreply.github.com","author":"Session小胡","message":"feat: 各种接口补充与错误修正 (#1066)"},{"hash":"4dac6cc2d0013c06c5cdf397d9dfc72a1c3531c4","time":1696153717000,"email":"catlair@qq.com","author":"LaMerChiang","message":"标注部分 wbi 链接 (#827)"},{"hash":"76bca78c1ccc9c1c6ac75bb4307406e478b5a249","time":1690791663000,"email":"61458340+eya46@users.noreply.github.com","author":"eya46","message":"Update hot.md (#763)"},{"hash":"f6760f4be38d5b592d396b211e48c666286524de","time":1677124138000,"email":"1440239038@qq.com","author":"SocialSisterYi","message":"🔨remove header index"},{"hash":"7d89ece2ac46425810647c4ac92acf5f3721cb68","time":1676998806000,"email":"1440239038@qq.com","author":"SocialSisterYi","message":"🚀调整项目结构"}]},"filePathRelative":"docs/search/hot.md"}');export{q as comp,C as data};