Skip to content

Commit

Permalink
fix(route): 修复 bilibili UP 主动态/用户关注动态 开启内嵌视频 参数错误的问题 (DIYgod#17462)
Browse files Browse the repository at this point in the history
  • Loading branch information
CaoMeiYouRen authored Nov 5, 2024
1 parent fe22d59 commit 2c2913b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 8 additions & 3 deletions lib/routes/bilibili/dynamic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const route: Route = {
| 键 | 含义 | 接受的值 | 默认值 |
| ---------- | --------------------------------- | -------------- | ------ |
| showEmoji | 显示或隐藏表情图片 | 0/1/true/false | false |
| embed | 默认开启内嵌视频 | 任意值 | |
| embed | 默认开启内嵌视频 | 0/1/true/false | true |
| useAvid | 视频链接使用 AV 号 (默认为 BV 号) | 0/1/true/false | false |
| directLink | 使用内容直链 | 0/1/true/false | false |
| hideGoods | 隐藏带货动态 | 0/1/true/false | false |
Expand Down Expand Up @@ -230,7 +230,7 @@ async function handler(ctx) {
const uid = ctx.req.param('uid');
const routeParams = Object.fromEntries(new URLSearchParams(ctx.req.param('routeParams')));
const showEmoji = fallback(undefined, queryToBoolean(routeParams.showEmoji), false);
const embed = !ctx.req.param('embed');
const embed = fallback(undefined, queryToBoolean(routeParams.embed), true);
const displayArticle = ctx.req.query('mode') === 'fulltext';
const useAvid = fallback(undefined, queryToBoolean(routeParams.useAvid), false);
const directLink = fallback(undefined, queryToBoolean(routeParams.directLink), false);
Expand Down Expand Up @@ -259,7 +259,12 @@ async function handler(ctx) {

const rssItems = await Promise.all(
items
.filter((item) => !hideGoods || item.modules.module_dynamic?.additional?.type !== 'ADDITIONAL_TYPE_GOODS')
.filter((item) => {
if (hideGoods) {
return item.modules.module_dynamic?.additional?.type !== 'ADDITIONAL_TYPE_GOODS';
}
return true;
})
.map(async (item) => {
// const parsed = JSONbig.parse(item.card);

Expand Down
4 changes: 2 additions & 2 deletions lib/routes/bilibili/followings-dynamic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const route: Route = {
| 键 | 含义 | 接受的值 | 默认值 |
| ---------- | --------------------------------- | -------------- | ------ |
| showEmoji | 显示或隐藏表情图片 | 0/1/true/false | false |
| embed | 默认开启内嵌视频 | 任意值 | |
| embed | 默认开启内嵌视频 | 0/1/true/false | true |
| useAvid | 视频链接使用 AV 号 (默认为 BV 号) | 0/1/true/false | false |
| directLink | 使用内容直链 | 0/1/true/false | false |
| hideGoods | 隐藏带货动态 | 0/1/true/false | false |
Expand Down Expand Up @@ -55,7 +55,7 @@ async function handler(ctx) {
const routeParams = querystring.parse(ctx.req.param('routeParams'));

const showEmoji = fallback(undefined, queryToBoolean(routeParams.showEmoji), false);
const embed = !ctx.req.param('embed');
const embed = fallback(undefined, queryToBoolean(routeParams.embed), true);
const displayArticle = fallback(undefined, queryToBoolean(routeParams.displayArticle), false);

const name = await cache.getUsernameFromUID(uid);
Expand Down

0 comments on commit 2c2913b

Please sign in to comment.