-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(route/bilibili): 哔哩哔哩入站必刷 (#16711)
* feat(route/bilibili): 哔哩哔哩入站必刷 * feat(route/bilibili): update
- Loading branch information
1 parent
020c8f6
commit 2d626f3
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}`, | ||
})), | ||
}; | ||
} |