feat(route): bilibili 动态中的视频链接默认改为 BV 号并增加配置参数;修改 专栏显示全文 的参数来源 (#13122)
* feat(route): 添加 百度股市通 * fix: 修改 百度股市通 路径 * docs: 添加 百度股市通 文档 * feat: 添加 radar 支持 * fix: 按字母顺序插入新路由 * feat(route): 新增 腾讯新闻 - 新型冠状病毒肺炎疫情实时追踪 * fix: 优化 腾讯新闻 - 新型冠状病毒肺炎疫情实时追踪 的标题 * fix: 修复 腾讯新闻 - 新型冠状病毒肺炎疫情实时追踪 部分情况下的非空判断 * fix: 修复 地区名称标题的问题 * fix: 腾讯新闻 - 新型冠状病毒肺炎疫情实时追踪 的 guid 增加 pubDate * fix: 修复 腾讯新闻 - 新型冠状病毒肺炎疫情实时追踪 guid 中添加 pubDate * fix: 修改 腾讯新闻 - 新型冠状病毒肺炎疫情实时追踪 的 title * feat(route): 修复 HelloGitHub 的 月刊 路由 * fix: remove guid * feat(route): 新增 bilibili 热搜 * feat(route): 完善 bilibili热搜 的 radar * fix: 优化 bilibili热搜 list 的非空判断 * fix: 修复 bilibili热搜路由失效 fix #12632 * fix(route): 修复 bilibili热搜路由 的校验逻辑计算 * fix: 优化 bilibili/utils 的 addVerifyInfo 逻辑 * feat(route): bilibili 动态中的视频链接默认改为 BV 号并增加配置参数;修改 专栏显示全文 的参数来源 * fix(route): 修复 fulltext 来源错误;修复 addVerifyInfo 逻辑错误 * fix(route): 移除不必要的参数
This commit is contained in:
parent
55b7c30d6a
commit
a7b4300269
|
|
@ -70,10 +70,10 @@ const cache = require('./cache');
|
|||
module.exports = async (ctx) => {
|
||||
const uid = ctx.params.uid;
|
||||
const routeParams = querystring.parse(ctx.params.routeParams);
|
||||
|
||||
const showEmoji = fallback(undefined, queryToBoolean(routeParams.showEmoji), false);
|
||||
const disableEmbed = fallback(undefined, queryToBoolean(routeParams.disableEmbed), false);
|
||||
const displayArticle = fallback(undefined, queryToBoolean(routeParams.displayArticle), false);
|
||||
const displayArticle = ctx.query.mode === 'fulltext';
|
||||
const useAvid = fallback(undefined, queryToBoolean(routeParams.useAvid), false);
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
|
|
@ -83,10 +83,9 @@ module.exports = async (ctx) => {
|
|||
},
|
||||
transformResponse: [(data) => data],
|
||||
});
|
||||
const data = JSONbig.parse(response.body).data.cards;
|
||||
|
||||
const cards = JSONbig.parse(response.body).data.cards;
|
||||
const items = await Promise.all(
|
||||
data.map(async (item) => {
|
||||
cards.map(async (item) => {
|
||||
const getTitle = (data) => (data ? data.title || data.description || data.content || (data.vest && data.vest.content) || '' : '');
|
||||
const getDes = (data) =>
|
||||
data.dynamic || data.desc || data.description || data.content || data.summary || (data.vest && data.vest.content) + (data.sketch && `<br>${data.sketch.title}<br>${data.sketch.desc_text}`) || data.intro || '';
|
||||
|
|
@ -176,7 +175,8 @@ module.exports = async (ctx) => {
|
|||
}
|
||||
let url;
|
||||
if (data.aid) {
|
||||
url = `https://www.bilibili.com/video/av${data.aid}`;
|
||||
const id = useAvid ? `av${data.aid}` : item?.desc?.bvid || item?.desc?.origin?.bvid;
|
||||
url = `https://www.bilibili.com/video/${id}`;
|
||||
return `<br>视频地址:<a href=${url}>${url}</a>`;
|
||||
}
|
||||
if (data.image_urls) {
|
||||
|
|
@ -222,10 +222,10 @@ module.exports = async (ctx) => {
|
|||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: `${data[0].desc.user_profile.info.uname} 的 bilibili 动态`,
|
||||
title: `${cards[0]?.desc?.user_profile?.info.uname} 的 bilibili 动态`,
|
||||
link: `https://space.bilibili.com/${uid}/dynamic`,
|
||||
description: `${data[0].desc.user_profile.info.uname} 的 bilibili 动态`,
|
||||
image: data[0].desc.user_profile.info.face,
|
||||
description: `${cards[0]?.desc?.user_profile?.info?.uname} 的 bilibili 动态`,
|
||||
image: cards[0]?.desc?.user_profile?.info?.face,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -7,7 +7,9 @@ function iframe(aid, page, bvid) {
|
|||
}
|
||||
|
||||
const addVerifyInfo = (params, verifyString) => {
|
||||
const verifyParam = params.split('&').sort().join('&');
|
||||
const searchParams = new URLSearchParams(params);
|
||||
searchParams.sort();
|
||||
const verifyParam = searchParams.toString();
|
||||
const wts = Math.round(Date.now() / 1000);
|
||||
const w_rid = md5(`${verifyParam}&wts=${wts}${verifyString}`);
|
||||
return `${params}&w_rid=${w_rid}&wts=${wts}`;
|
||||
|
|
|
|||
|
|
@ -48,9 +48,17 @@ Tiny Tiny RSS 会给所有 iframe 元素添加 `sandbox="allow-scripts"` 属性
|
|||
| -- | ---- | ------- | ------ |
|
||||
| showEmoji | 显示或隐藏表情图片 | 0/1/true/false | false |
|
||||
| disableEmbed | 关闭内嵌视频 | 0/1/true/false | false |
|
||||
| displayArticle | 专栏显示全文 | 0/1/true/false | false |
|
||||
| useAvid | 视频链接使用AV号(默认为BV号) | 0/1/true/false | false |
|
||||
|
||||
用例:`/bilibili/user/dynamic/2267573/showEmoji=1&disableEmbed=1&displayArticle=1`
|
||||
用例:`/bilibili/user/dynamic/2267573/showEmoji=1&disableEmbed=1&useAvid=1`
|
||||
|
||||
:::tip 动态的专栏显示全文
|
||||
|
||||
动态的专栏显示全文请使用通用参数里的 `mode=fulltext `
|
||||
|
||||
举例: bilibili 专栏全文输出 /bilibili/user/dynamic/2267573/?mode=fulltext
|
||||
|
||||
:::
|
||||
|
||||
</Route>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue