feat: 新增 bilibili 热搜 (#11958)
* 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 的非空判断
This commit is contained in:
parent
efd2bf2332
commit
3ff6482548
|
|
@ -302,6 +302,10 @@ Tiny Tiny RSS 会给所有 iframe 元素添加 `sandbox="allow-scripts"` 属性
|
|||
|
||||
<Route author="ziminliu" example="/bilibili/popular/all" path="/bilibili/popular/all" />
|
||||
|
||||
### bilibili 热搜
|
||||
|
||||
<Route author="CaoMeiYouRen" example="/bilibili/hot-search" path="/bilibili/hot-search" />
|
||||
|
||||
### 排行榜
|
||||
|
||||
<Route author="DIYgod" example="/bilibili/ranking/0/3/1" path="/bilibili/ranking/:tid/:days?/:arc_type?/:disableEmbed?" :paramsDesc="['排行榜分区 id, 默认 0', '时间跨度, 可为 1 3 7 30', '投稿时间, 可为 0(全部投稿) 1(近期投稿) , 默认 1', '默认为开启内嵌视频, 任意值为关闭']">
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const url = `https://api.bilibili.com/x/web-interface/wbi/search/square?limit=10&platform=web&wts=${Math.floor(Date.now() / 1000)}`;
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url,
|
||||
headers: {
|
||||
Referer: `https://api.bilibili.com`,
|
||||
},
|
||||
});
|
||||
const trending = response?.data?.data?.trending;
|
||||
const title = trending?.title;
|
||||
const list = trending?.list || [];
|
||||
ctx.state.data = {
|
||||
title,
|
||||
link: url,
|
||||
description: 'bilibili热搜',
|
||||
item: list.map((item) => ({
|
||||
title: item.keyword,
|
||||
description: `${item.keyword}<br>${item.icon ? `<img src="${item.icon}">` : ''}`,
|
||||
link: item.link || item.goto || `https://search.bilibili.com/all?${new URLSearchParams({ keyword: item.keyword })}&from_source=webtop_search`,
|
||||
})),
|
||||
};
|
||||
};
|
||||
|
|
@ -8,6 +8,7 @@ module.exports = {
|
|||
'/followings/article/:uid': ['woshiluo'],
|
||||
'/followings/dynamic/:uid/:disableEmbed?': ['TigerCubDen'],
|
||||
'/followings/video/:uid/:disableEmbed?': ['LogicJake'],
|
||||
'/hot-search': ['CaoMeiYouRen'],
|
||||
'/link/news/:product': ['Qixingchen'],
|
||||
'/live/area/:areaID/:order': ['Qixingchen'],
|
||||
'/live/room/:roomID': ['Qixingchen'],
|
||||
|
|
|
|||
|
|
@ -34,6 +34,12 @@ module.exports = {
|
|||
source: '/video/online.html',
|
||||
target: '/bilibili/online',
|
||||
},
|
||||
{
|
||||
title: 'bilibili热搜',
|
||||
docs: 'https://docs.rsshub.app/social-media.html#bilibili',
|
||||
source: '/',
|
||||
target: '/bilibili/hot-search',
|
||||
},
|
||||
],
|
||||
space: [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ module.exports = (router) => {
|
|||
router.get('/followings/dynamic/:uid/:disableEmbed?', require('./followings_dynamic'));
|
||||
router.get('/followings/video/:uid/:disableEmbed?', require('./followings_video'));
|
||||
router.get('/link/news/:product', require('./linkNews'));
|
||||
router.get('/hot-search', require('./hotSearch'));
|
||||
router.get('/live/area/:areaID/:order', require('./liveArea'));
|
||||
router.get('/live/room/:roomID', require('./liveRoom'));
|
||||
router.get('/live/search/:key/:order', require('./liveSearch'));
|
||||
|
|
|
|||
|
|
@ -48,7 +48,11 @@ module.exports = async (ctx) => {
|
|||
} catch (e) {
|
||||
if (e.code === 'ERR_NON_2XX_3XX_RESPONSE') {
|
||||
hasArticle = false;
|
||||
apiUrl = toApiUrl(dayjs().subtract(++i, 'day').format('YYYYMMDD'));
|
||||
apiUrl = toApiUrl(
|
||||
dayjs()
|
||||
.subtract(++i, 'day')
|
||||
.format('YYYYMMDD')
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue