Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/core/searcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ class Searcher {
log.info('获取动态', `开始获取带话题#${tag_name}#的动态信息`);

const
tag_id = await bili.getTagIDByTagName(tag_name),
tag_id = await bili.searchTagIDByTagName(tag_name),
hotdy = await bili.getHotDynamicInfoByTagID(tag_id),
modDR = modifyDynamicRes(hotdy);

Expand Down
2 changes: 1 addition & 1 deletion lib/net/api.bili.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module.exports = Object.freeze({
SESSION_SVR_UPDATE_ACK: 'https://api.vc.bilibili.com/session_svr/v1/session_svr/update_ack',
SHORTLINK: 'https://b23.tv/{{short_id}}',
SPACE_MYINFO: 'https://api.bilibili.com/x/space/myinfo',
TAG_INFO: 'https://api.bilibili.com/x/tag/info',
TOPIC_PUB_SEARCH: "https://app.bilibili.com/x/topic/pub/search",
TOP_FEED_RCMD: "https://api.bilibili.com/x/web-interface/index/top/feed/rcmd",
TOP_RCMD: "https://api.bilibili.com/x/web-interface/index/top/rcmd",
TOPIC_SVR_TOPIC_HISTORY: 'https://api.vc.bilibili.com/topic_svr/v1/topic_svr/topic_history',
Expand Down
18 changes: 11 additions & 7 deletions lib/net/bili.js
Original file line number Diff line number Diff line change
Expand Up @@ -484,27 +484,31 @@ const bili_client = {
})
},
/**
* 通过tag名获取tag的id
* 通过tag名搜索tag的id
* @param {string} tag_name
* tag名
* @returns {Promise<number | -1>}
* 正确:tag_ID
* 错误:-1
*/
async getTagIDByTagName(tag_name) {
async searchTagIDByTagName(tag_name) {
const
responseText = await get({
url: API.TAG_INFO,
url: API.TOPIC_PUB_SEARCH,
query: {
tag_name
keywords: tag_name
}
}),
res = strToJson(responseText);
if (res.code !== 0) {
res = strToJson(responseText),
{ data = {} } = res,
{ topic_items = [{}] } = data,
{ id = -1, name } = topic_items[0];
if (id === -1) {
log.error('获取TagID', '失败');
return -1;
} else {
return res.data.tag_id;
log.info('获取TagID', `${name} -> ${id}`);
return id;
}
},
/**
Expand Down