Skip to content

Commit

Permalink
feat(route/bilibili): 哔哩哔哩入站必刷 (#16711)
Browse files Browse the repository at this point in the history
* feat(route/bilibili): 哔哩哔哩入站必刷

* feat(route/bilibili): update
  • Loading branch information
liuyuhe666 committed Sep 13, 2024
1 parent 020c8f6 commit 2d626f3
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions lib/routes/bilibili/bilibili-recommend.ts
Original file line number Diff line number Diff line change
@@ -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 ? '' : `<br><br>${utils.iframe(item.aid, null, item.bvid)}`}<br><img src="${item.pic}">`,
link: item.bvid ? `https://www.bilibili.com/video/${item.bvid}` : `https://www.bilibili.com/video/av${item.aid}`,
})),
};
}

0 comments on commit 2d626f3

Please sign in to comment.