From 4f44368056334a50dd2cb5c90506b6331b830cb8 Mon Sep 17 00:00:00 2001 From: liuzimin <52102992+ziminliu@users.noreply.github.com> Date: Thu, 28 Jul 2022 23:48:06 +0800 Subject: [PATCH] =?UTF-8?q?feat(route):=20bilibili=20=E7=BB=BC=E5=90=88?= =?UTF-8?q?=E7=83=AD=E9=97=A8=20(#10343)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(route): bilibili 综合热门 * fix: update maintainers * refactor: sort router --- docs/social-media.md | 4 ++++ lib/v2/bilibili/maintainer.js | 40 +++++++++++++++++++++++++++++++++++ lib/v2/bilibili/popular.js | 29 +++++++++++++++++++++++++ lib/v2/bilibili/router.js | 3 ++- 4 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 lib/v2/bilibili/maintainer.js create mode 100644 lib/v2/bilibili/popular.js diff --git a/docs/social-media.md b/docs/social-media.md index b471910cd..3411606d5 100644 --- a/docs/social-media.md +++ b/docs/social-media.md @@ -290,6 +290,10 @@ Tiny Tiny RSS 会给所有 iframe 元素添加 `sandbox="allow-scripts"` 属性 +### 综合热门 + + + ### 排行榜 diff --git a/lib/v2/bilibili/maintainer.js b/lib/v2/bilibili/maintainer.js new file mode 100644 index 000000000..bd1aebfde --- /dev/null +++ b/lib/v2/bilibili/maintainer.js @@ -0,0 +1,40 @@ +module.exports = { + '/app/:id?': ['nczitzk'], + '/audio/:id': ['LogicJake'], + '/blackboard': ['Qixingchen'], + '/bangumi/:seasonid': ['DIYgod'], + '/bangumi/media/:mediaid': ['DIYgod'], + '/fav/:uid/:fid/:disableEmbed?': ['Qixingchen'], + '/followings/article/:uid': ['woshiluo'], + '/followings/dynamic/:uid/:disableEmbed?': ['TigerCubDen'], + '/followings/video/:uid/:disableEmbed?': ['LogicJake'], + '/link/news/:product': ['Qixingchen'], + '/live/area/:areaID/:order': ['Qixingchen'], + '/live/room/:roomID': ['Qixingchen'], + '/live/search/:key/:order': ['Qixingchen'], + '/mall/new/:category?': ['DIYgod'], + '/mall/ip/:id': ['DIYgod'], + '/manga/update/:comicid': ['hoilc'], + '/manga/followings/:uid/:limits?': ['yindaheng98'], + '/online/:disableEmbed?': ['TigerCubDen'], + '/partion/:tid/:disableEmbed?': ['DIYgod'], + '/partion/ranking/:tid/:days?/:disableEmbed?': ['lengthmin'], + '/popular/all': ['ziminliu'], + '/ranking/:rid?/:day?/:arc_type?/:disableEmbed?': ['DIYgod'], + '/readlist/:listid': ['hoilc'], + '/topic/:topic': ['Qixingchen'], + '/user/article/:uid': ['lengthmin'], + '/user/bangumi/:uid/:type?': ['wdssmq'], + '/user/channel/:uid/:cid/:disableEmbed?': ['HenryQW'], + '/user/coin/:uid/:disableEmbed?': ['DIYgod'], + '/user/dynamic/:uid/:disableEmbed?': ['DIYgod', 'zytomorrow'], + '/user/fav/:uid/:disableEmbed?': ['DIYgod'], + '/user/followers/:uid': ['Qixingchen'], + '/user/followings/:uid': ['Qixingchen'], + '/user/video/:uid/:disableEmbed?': ['DIYgod'], + '/video/danmaku/:bvid/:pid?': ['Qixingchen'], + '/video/page/:bvid/:disableEmbed?': ['sxzz'], + '/video/reply/:bvid': ['Qixingchen'], + '/vsearch/:kw/:order?/:disableEmbed?/:tid?': ['Symty'], + '/weekly/:disableEmbed?': ['ttttmr'], +}; diff --git a/lib/v2/bilibili/popular.js b/lib/v2/bilibili/popular.js new file mode 100644 index 000000000..44d6412bd --- /dev/null +++ b/lib/v2/bilibili/popular.js @@ -0,0 +1,29 @@ +const got = require('@/utils/got'); +const utils = require('./utils'); + +module.exports = async (ctx) => { + const disableEmbed = ctx.params.disableEmbed; + const response = await got({ + method: 'get', + url: `https://api.bilibili.com/x/web-interface/popular`, + headers: { + Referer: 'https://www.bilibili.com/', + }, + }); + const list = response.data.data.list; + + ctx.state.data = { + title: `bilibili 综合热门`, + link: 'https://www.bilibili.com', + description: `bilibili 综合热门`, + item: + list && + list.map((item) => ({ + title: item.title, + description: `${item.desc}${!disableEmbed ? `

${utils.iframe(item.aid)}` : ''}
`, + pubDate: new Date(item.pubdate * 1000).toUTCString(), + link: item.pubdate > utils.bvidTime && item.bvid ? `https://www.bilibili.com/video/${item.bvid}` : `https://www.bilibili.com/video/av${item.aid}`, + author: item.owner.name, + })), + }; +}; diff --git a/lib/v2/bilibili/router.js b/lib/v2/bilibili/router.js index 7a6ab3f11..eb041593a 100644 --- a/lib/v2/bilibili/router.js +++ b/lib/v2/bilibili/router.js @@ -19,6 +19,7 @@ module.exports = (router) => { router.get('/online/:disableEmbed?', require('./online')); router.get('/partion/:tid/:disableEmbed?', require('./partion')); router.get('/partion/ranking/:tid/:days?/:disableEmbed?', require('./partion-ranking')); + router.get('/popular/all', require('./popular')); router.get('/ranking/:rid?/:day?/:arc_type?/:disableEmbed?', require('./ranking')); router.get('/readlist/:listid', require('./readlist')); router.get('/topic/:topic', require('./topic')); @@ -35,5 +36,5 @@ module.exports = (router) => { router.get('/video/page/:bvid/:disableEmbed?', require('./page')); router.get('/video/reply/:bvid', require('./reply')); router.get('/vsearch/:kw/:order?/:disableEmbed?/:tid?', require('./vsearch')); - router.get('/weekly', require('./weekly_recommend')); + router.get('/weekly/:disableEmbed?', require('./weekly_recommend')); };