From 2d626f3a1978f18245f44948c8d875c3c3016704 Mon Sep 17 00:00:00 2001
From: Liu Yuhe <171144077+liuyuhe666@users.noreply.github.com>
Date: Fri, 13 Sep 2024 08:35:39 +0800
Subject: [PATCH] =?UTF-8?q?feat(route/bilibili):=20=E5=93=94=E5=93=A9?=
=?UTF-8?q?=E5=93=94=E5=93=A9=E5=85=A5=E7=AB=99=E5=BF=85=E5=88=B7=20(#1671?=
=?UTF-8?q?1)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* feat(route/bilibili): 哔哩哔哩入站必刷
* feat(route/bilibili): update
---
lib/routes/bilibili/bilibili-recommend.ts | 42 +++++++++++++++++++++++
1 file changed, 42 insertions(+)
create mode 100644 lib/routes/bilibili/bilibili-recommend.ts
diff --git a/lib/routes/bilibili/bilibili-recommend.ts b/lib/routes/bilibili/bilibili-recommend.ts
new file mode 100644
index 00000000000000..0943741fc08a9c
--- /dev/null
+++ b/lib/routes/bilibili/bilibili-recommend.ts
@@ -0,0 +1,42 @@
+import { Route } from '@/types';
+import got from '@/utils/got';
+import utils from './utils';
+
+export const route: Route = {
+ path: '/precious/:disableEmbed?',
+ categories: ['social-media'],
+ example: '/bilibili/precious',
+ parameters: { disableEmbed: '默认为开启内嵌视频, 任意值为关闭' },
+ features: {
+ requireConfig: false,
+ requirePuppeteer: false,
+ antiCrawler: false,
+ supportBT: false,
+ supportPodcast: false,
+ supportScihub: false,
+ },
+ name: '入站必刷',
+ maintainers: ['liuyuhe666'],
+ handler,
+};
+
+async function handler(ctx) {
+ const disableEmbed = ctx.req.param('disableEmbed');
+ const response = await got({
+ method: 'get',
+ url: 'https://api.bilibili.com/x/web-interface/popular/precious',
+ headers: {
+ Referer: 'https://www.bilibili.com/v/popular/history',
+ },
+ });
+ const data = response.data.data.list;
+ return {
+ title: '哔哩哔哩入站必刷',
+ link: 'https://www.bilibili.com/v/popular/history',
+ item: data.map((item) => ({
+ title: item.title,
+ description: `${item.desc || item.title}${disableEmbed ? '' : `
${utils.iframe(item.aid, null, item.bvid)}`}
`,
+ link: item.bvid ? `https://www.bilibili.com/video/${item.bvid}` : `https://www.bilibili.com/video/av${item.aid}`,
+ })),
+ };
+}