Skip to content

Commit

Permalink
fix: 查询动态详情的接口失效 (#349)
Browse files Browse the repository at this point in the history
  • Loading branch information
shanmiteko committed Mar 25, 2024
1 parent d9dba6f commit d337fb2
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 81 deletions.
9 changes: 1 addition & 8 deletions lib/net/api.bili.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,7 @@ module.exports = Object.freeze({
DYNAMIC_REPOST_SHARE: 'https://api.vc.bilibili.com/dynamic_repost/v1/dynamic_repost/share',
DYNAMIC_SVR_CREATE_DRAW: 'https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/create_draw',
DYNAMIC_SVR_CREATE: 'https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/create',
DYNAMIC_SVR_GET_DYNAMIC_DETAIL_V1: 'https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/get_dynamic_detail',
DYNAMIC_SVR_GET_DYNAMIC_DETAIL_V10: 'https://api.vc.bilibili.com/dynamic_svr/v10/dynamic_svr/get_dynamic_detail',
DYNAMIC_SVR_GET_DYNAMIC_DETAIL_V100: 'https://api.vc.bilibili.com/dynamic_svr/v100/dynamic_svr/get_dynamic_detail',
DYNAMIC_SVR_GET_DYNAMIC_DETAIL_V1000: 'https://api.vc.bilibili.com/dynamic_svr/v1000/dynamic_svr/get_dynamic_detail',
DYNAMIC_SVR_GET_DYNAMIC_DETAIL_V10000: 'https://api.vc.bilibili.com/dynamic_svr/v10000/dynamic_svr/get_dynamic_detail',
DYNAMIC_SVR_GET_DYNAMIC_DETAIL_V100000: 'https://api.vc.bilibili.com/dynamic_svr/v100000/dynamic_svr/get_dynamic_detail',
DYNAMIC_SVR_GET_DYNAMIC_DETAIL_V1000000: 'https://api.vc.bilibili.com/dynamic_svr/v1000000/dynamic_svr/get_dynamic_detail',
DYNAMIC_SVR_GET_DYNAMIC_DETAIL_V10000000: 'https://api.vc.bilibili.com/dynamic_svr/v10000000/dynamic_svr/get_dynamic_detail',
DYNAMIC_SVR_GET_DYNAMIC_DETAIL_V: 'https://api.vc.bilibili.com/dynamic_svr/v{{v}}/dynamic_svr/get_dynamic_detail',
DYNAMIC_SVR_RM_DYNAMIC: 'https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/rm_dynamic',
DYNAMIC_SVR_SPACE_HISTORY: 'https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/space_history',
FEED_GET_ATTENTION_LIST: 'https://api.vc.bilibili.com/feed/v1/feed/get_attention_list',
Expand Down
101 changes: 28 additions & 73 deletions lib/net/bili.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,81 +412,36 @@ const bili_client = {
return dyid
})
},
_getOneDynamicByDyid: new Line('获取一个动态的细节', [
(dynamic_id) => get({
url: API.DYNAMIC_SVR_GET_DYNAMIC_DETAIL_V10,
config: { retry: false },
query: {
dynamic_id
}
}),
(dynamic_id) => get({
url: API.DYNAMIC_SVR_GET_DYNAMIC_DETAIL_V100,
config: { retry: false },
query: {
dynamic_id
}
}),
(dynamic_id) => get({
url: API.DYNAMIC_SVR_GET_DYNAMIC_DETAIL_V1000,
config: { retry: false },
query: {
dynamic_id
}
}),
(dynamic_id) => get({
url: API.DYNAMIC_SVR_GET_DYNAMIC_DETAIL_V10000,
config: { retry: false },
query: {
dynamic_id
}
}),
(dynamic_id) => get({
url: API.DYNAMIC_SVR_GET_DYNAMIC_DETAIL_V100000,
config: { retry: false },
query: {
dynamic_id
}
}),
(dynamic_id) => get({
url: API.DYNAMIC_SVR_GET_DYNAMIC_DETAIL_V1000000,
config: { retry: false },
query: {
dynamic_id
}
}),
(dynamic_id) => get({
url: API.DYNAMIC_SVR_GET_DYNAMIC_DETAIL_V10000000,
config: { retry: false },
query: {
dynamic_id
}
}),
(dynamic_id) => get({
url: API.DYNAMIC_SVR_GET_DYNAMIC_DETAIL_V1,
config: { retry: false },
query: {
dynamic_id
_getOneDynamicByDyid: new Line(
'获取一个动态的细节',
Array(10)
.fill(
(dynamic_id) => get({
url: API.DYNAMIC_SVR_GET_DYNAMIC_DETAIL_V.replace('{{v}}', Math.floor(Math.random() * 10 ** 10)),
config: { retry: false },
query: {
dynamic_id
}
})
)
, responseText => {
const
res = strToJson(responseText),
{ code, data } = res,
{ card } = data || {};
switch (code) {
case 0:
if (card) {
return [false, card, `ok`];
} else {
return [false, undefined, `动态不存在`];
}
case 500207:
return [false, undefined, `该动态为包月充电专属可以给UP主充电后观看`];
default:
return [true, undefined, `获取动态数据出错:\n${responseText}`]
}
}),
], responseText => {
const
res = strToJson(responseText),
{ code, data } = res,
{ card } = data || {};
switch (code) {
case 0:
if (card) {
return [false, card, `ok`];
} else {
return [false, undefined, `动态不存在`];
}
case 500207:
return [false, undefined, `该动态为包月充电专属可以给UP主充电后观看`];
default:
return [true, undefined, `获取动态数据出错:\n${responseText}`]
}
}),
/**
* 获取一个动态的细节
* @param {string} dynamic_id
Expand Down

0 comments on commit d337fb2

Please sign in to comment.