Compare commits

...
Author SHA1 Message Date
shanmite e5309b6782 Merge branch 'main' into getLotteryInfoByTag 2023-06-28 15:32:51 +08:00
shanmite 1e6273f6b2 getLotteryInfoByTag 2023-06-28 15:17:43 +08:00
3 changed files with 13 additions and 9 deletions
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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',
+11 -7
View File
@@ -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;
}
},
/**