feat: bilibili embed
This commit is contained in:
parent
6c84eb496c
commit
e71ed5fafa
|
|
@ -16,7 +16,7 @@ pageClass: routes
|
|||
|
||||
### UP 主投稿
|
||||
|
||||
<Route author="DIYgod" example="/bilibili/user/video/2267573" path="/bilibili/user/video/:uid" :paramsDesc="['用户 id, 可在 UP 主主页中找到']" radar="1"/>
|
||||
<Route author="DIYgod" example="/bilibili/user/video/2267573" path="/bilibili/user/video/:uid/:disableEmbed?" :paramsDesc="['用户 id, 可在 UP 主主页中找到', '默认为开启内嵌视频, 任意值为关闭']" radar="1"/>
|
||||
|
||||
### UP 主专栏
|
||||
|
||||
|
|
@ -24,23 +24,23 @@ pageClass: routes
|
|||
|
||||
### UP 主动态
|
||||
|
||||
<Route author="DIYgod" example="/bilibili/user/dynamic/2267573" path="/bilibili/user/dynamic/:uid" :paramsDesc="['用户 id, 可在 UP 主主页中找到']" radar="1"/>
|
||||
<Route author="DIYgod" example="/bilibili/user/dynamic/2267573" path="/bilibili/user/dynamic/:uid/:disableEmbed?" :paramsDesc="['用户 id, 可在 UP 主主页中找到', '默认为开启内嵌视频, 任意值为关闭']" radar="1"/>
|
||||
|
||||
### UP 主频道
|
||||
|
||||
<Route author="HenryQW" example="/bilibili/user/channel/142821407/49017" path="/bilibili/user/channel/:uid/:cid" :paramsDesc="['用户 id, 可在 UP 主主页中找到', '频道 id, 可在频道的 URL 中找到']"/>
|
||||
<Route author="HenryQW" example="/bilibili/user/channel/142821407/49017" path="/bilibili/user/channel/:uid/:cid/:disableEmbed?" :paramsDesc="['用户 id, 可在 UP 主主页中找到', '频道 id, 可在频道的 URL 中找到', '默认为开启内嵌视频, 任意值为关闭']"/>
|
||||
|
||||
### UP 主默认收藏夹
|
||||
|
||||
<Route author="DIYgod" example="/bilibili/user/fav/2267573" path="/bilibili/user/fav/:uid" :paramsDesc="['用户 id, 可在 UP 主主页中找到']"/>
|
||||
<Route author="DIYgod" example="/bilibili/user/fav/2267573" path="/bilibili/user/fav/:uid/:disableEmbed?" :paramsDesc="['用户 id, 可在 UP 主主页中找到', '默认为开启内嵌视频, 任意值为关闭']"/>
|
||||
|
||||
### UP 主非默认收藏夹
|
||||
|
||||
<Route author="Qixingchen" example="/bilibili/fav/756508/50948568" path="/bilibili/fav/:uid/:fid" :paramsDesc="['用户 id, 可在 UP 主主页中找到', '收藏夹 ID, 可在收藏夹的 URL 中找到, 默认收藏夹建议使用 UP 主默认收藏夹功能']"/>
|
||||
<Route author="Qixingchen" example="/bilibili/fav/756508/50948568" path="/bilibili/fav/:uid/:fid/:disableEmbed?" :paramsDesc="['用户 id, 可在 UP 主主页中找到', '收藏夹 ID, 可在收藏夹的 URL 中找到, 默认收藏夹建议使用 UP 主默认收藏夹功能', '默认为开启内嵌视频, 任意值为关闭']"/>
|
||||
|
||||
### UP 主投币视频
|
||||
|
||||
<Route author="DIYgod" example="/bilibili/user/coin/2267573" path="/bilibili/user/coin/:uid" :paramsDesc="['用户 id, 可在 UP 主主页中找到']"/>
|
||||
<Route author="DIYgod" example="/bilibili/user/coin/2267573" path="/bilibili/user/coin/:uid/:disableEmbed?" :paramsDesc="['用户 id, 可在 UP 主主页中找到', '默认为开启内嵌视频, 任意值为关闭']"/>
|
||||
|
||||
### UP 主粉丝
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ pageClass: routes
|
|||
|
||||
### 分区视频
|
||||
|
||||
<Route author="DIYgod" example="/bilibili/partion/33" path="/bilibili/partion/:tid" :paramsDesc="['分区 id']" radar="1">
|
||||
<Route author="DIYgod" example="/bilibili/partion/33" path="/bilibili/partion/:tid/:disableEmbed?" :paramsDesc="['分区 id', '默认为开启内嵌视频, 任意值为关闭']" radar="1">
|
||||
|
||||
动画
|
||||
|
||||
|
|
@ -154,11 +154,11 @@ pageClass: routes
|
|||
|
||||
### 分区视频排行榜
|
||||
|
||||
<Route author="lengthmin" example="/bilibili/partion/ranking/171/3" path="/bilibili/partion/ranking/:tid/:days?" :paramsDesc="['分区 id, 见上方表格', '缺省为 7, 指最近多少天内的热度排序']"/>
|
||||
<Route author="lengthmin" example="/bilibili/partion/ranking/171/3" path="/bilibili/partion/ranking/:tid/:days?/:disableEmbed?" :paramsDesc="['分区 id, 见上方表格', '缺省为 7, 指最近多少天内的热度排序', '默认为开启内嵌视频, 任意值为关闭']"/>
|
||||
|
||||
### 视频选集列表
|
||||
|
||||
<Route author="sxzz" example="/bilibili/video/page/39732828" path="/bilibili/video/page/:aid" :paramsDesc="['可在视频页 URL 中找到']"/>
|
||||
<Route author="sxzz" example="/bilibili/video/page/39732828" path="/bilibili/video/page/:aid/:disableEmbed?" :paramsDesc="['可在视频页 URL 中找到', '默认为开启内嵌视频, 任意值为关闭']"/>
|
||||
|
||||
### 视频评论
|
||||
|
||||
|
|
@ -174,11 +174,11 @@ pageClass: routes
|
|||
|
||||
### 视频搜索
|
||||
|
||||
<Route author="Symty" example="/bilibili/vsearch/藤原千花" path="/bilibili/vsearch/:kw/:order?" :paramsDesc="['检索关键字', '排序方式, 综合:totalrank 最多点击:click 最新发布:pubdate(缺省) 最多弹幕:dm 最多收藏:stow']"/>
|
||||
<Route author="Symty" example="/bilibili/vsearch/藤原千花" path="/bilibili/vsearch/:kw/:order?/:disableEmbed?" :paramsDesc="['检索关键字', '排序方式, 综合:totalrank 最多点击:click 最新发布:pubdate(缺省) 最多弹幕:dm 最多收藏:stow', '默认为开启内嵌视频, 任意值为关闭']"/>
|
||||
|
||||
### 用户关注视频动态
|
||||
|
||||
<Route author="LogicJake" example="/bilibili/followings/video/2267573" path="/bilibili/followings/video/:uid" :paramsDesc="['用户 id']">
|
||||
<Route author="LogicJake" example="/bilibili/followings/video/2267573" path="/bilibili/followings/video/:uid/:disableEmbed?" :paramsDesc="['用户 id', '默认为开启内嵌视频, 任意值为关闭']">
|
||||
::: warning 注意
|
||||
|
||||
用户动态需要 b 站登录后的 Cookie 值,所以只能自建,详情见部署页面的配置模块。
|
||||
|
|
@ -222,7 +222,7 @@ pageClass: routes
|
|||
|
||||
### 排行榜
|
||||
|
||||
<Route author="DIYgod" example="/bilibili/ranking/0/3/1" path="/bilibili/ranking/:tid/:days?/:arc_type?" :paramsDesc="['排行榜分区 id, 默认 0', '时间跨度, 可为 1 3 7 30', '投稿时间, 可为 0(全部投稿) 1(近期投稿) , 默认 1']">
|
||||
<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', '默认为开启内嵌视频, 任意值为关闭']">
|
||||
|
||||
| 全站 | 动画 | 国创相关 | 音乐 | 舞蹈 | 游戏 | 科技 | 生活 | 鬼畜 | 时尚 | 娱乐 | 影视 |
|
||||
| ---- | ---- | -------- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- |
|
||||
|
|
@ -384,15 +384,15 @@ pageClass: routes
|
|||
|
||||
### 用户
|
||||
|
||||
<Route author="DIYgod" example="/youtube/user/JFlaMusic/" path="/youtube/user/:username/:embed?" :paramsDesc="['用户名', '默认为开启内嵌视频, 任意值为关闭']" radar="1"/>
|
||||
<Route author="DIYgod" example="/youtube/user/JFlaMusic/" path="/youtube/user/:username/:disableEmbed?" :paramsDesc="['用户名', '默认为开启内嵌视频, 任意值为关闭']" radar="1"/>
|
||||
|
||||
### 频道
|
||||
|
||||
<Route author="DIYgod" example="/youtube/channel/UCDwDMPOZfxVV0x_dz0eQ8KQ" path="/youtube/channel/:id/:embed?" :paramsDesc="['频道 id', '默认为开启内嵌视频, 任意值为关闭']" radar="1"/>
|
||||
<Route author="DIYgod" example="/youtube/channel/UCDwDMPOZfxVV0x_dz0eQ8KQ" path="/youtube/channel/:id/:disableEmbed?" :paramsDesc="['频道 id', '默认为开启内嵌视频, 任意值为关闭']" radar="1"/>
|
||||
|
||||
### 播放列表
|
||||
|
||||
<Route author="HenryQW" example="/youtube/playlist/PLqQ1RwlxOgeLTJ1f3fNMSwhjVgaWKo_9Z" path="/youtube/playlist/:id/:embed?" :paramsDesc="['播放列表 id', '默认为开启内嵌视频, 任意值为关闭']" radar="1"/>
|
||||
<Route author="HenryQW" example="/youtube/playlist/PLqQ1RwlxOgeLTJ1f3fNMSwhjVgaWKo_9Z" path="/youtube/playlist/:id/:disableEmbed?" :paramsDesc="['播放列表 id', '默认为开启内嵌视频, 任意值为关闭']" radar="1"/>
|
||||
|
||||
## 币乎
|
||||
|
||||
|
|
|
|||
|
|
@ -34,35 +34,35 @@ router.get('/1draw/', require('./routes/1draw/index'));
|
|||
router.get('/1x/magazine', require('./routes/1x/magazine'));
|
||||
|
||||
// bilibili
|
||||
router.get('/bilibili/user/video/:uid', require('./routes/bilibili/video'));
|
||||
router.get('/bilibili/user/video/:uid/:disableEmbed?', require('./routes/bilibili/video'));
|
||||
router.get('/bilibili/user/article/:uid', require('./routes/bilibili/article'));
|
||||
router.get('/bilibili/user/fav/:uid', require('./routes/bilibili/userFav'));
|
||||
router.get('/bilibili/user/coin/:uid', require('./routes/bilibili/coin'));
|
||||
router.get('/bilibili/user/dynamic/:uid', require('./routes/bilibili/dynamic'));
|
||||
router.get('/bilibili/user/fav/:uid/:disableEmbed?', require('./routes/bilibili/userFav'));
|
||||
router.get('/bilibili/user/coin/:uid/:disableEmbed?', require('./routes/bilibili/coin'));
|
||||
router.get('/bilibili/user/dynamic/:uid/:disableEmbed?', require('./routes/bilibili/dynamic'));
|
||||
router.get('/bilibili/user/followers/:uid', require('./routes/bilibili/followers'));
|
||||
router.get('/bilibili/user/followings/:uid', require('./routes/bilibili/followings'));
|
||||
router.get('/bilibili/user/bangumi/:uid', require('./routes/bilibili/user_bangumi'));
|
||||
router.get('/bilibili/partion/:tid', require('./routes/bilibili/partion'));
|
||||
router.get('/bilibili/partion/ranking/:tid/:days?', require('./routes/bilibili/partion-ranking'));
|
||||
router.get('/bilibili/partion/:tid/:disableEmbed?', require('./routes/bilibili/partion'));
|
||||
router.get('/bilibili/partion/ranking/:tid/:days?/:disableEmbed?', require('./routes/bilibili/partion-ranking'));
|
||||
router.get('/bilibili/bangumi/:seasonid', require('./routes/bilibili/bangumi')); // 弃用
|
||||
router.get('/bilibili/bangumi/media/:mediaid', require('./routes/bilibili/bangumi'));
|
||||
router.get('/bilibili/video/page/:aid', require('./routes/bilibili/page'));
|
||||
router.get('/bilibili/video/page/:aid/:disableEmbed?', require('./routes/bilibili/page'));
|
||||
router.get('/bilibili/video/reply/:aid', require('./routes/bilibili/reply'));
|
||||
router.get('/bilibili/video/danmaku/:aid/:pid?', require('./routes/bilibili/danmaku'));
|
||||
router.get('/bilibili/link/news/:product', require('./routes/bilibili/linkNews'));
|
||||
router.get('/bilibili/live/room/:roomID', require('./routes/bilibili/liveRoom'));
|
||||
router.get('/bilibili/live/search/:key/:order', require('./routes/bilibili/liveSearch'));
|
||||
router.get('/bilibili/live/area/:areaID/:order', require('./routes/bilibili/liveArea'));
|
||||
router.get('/bilibili/fav/:uid/:fid', require('./routes/bilibili/fav'));
|
||||
router.get('/bilibili/fav/:uid/:fid/:disableEmbed?', require('./routes/bilibili/fav'));
|
||||
router.get('/bilibili/blackboard', require('./routes/bilibili/blackboard'));
|
||||
router.get('/bilibili/mall/new', require('./routes/bilibili/mallNew'));
|
||||
router.get('/bilibili/mall/ip/:id', require('./routes/bilibili/mallIP'));
|
||||
router.get('/bilibili/ranking/:rid?/:day?/:arc_type?', require('./routes/bilibili/ranking'));
|
||||
router.get('/bilibili/user/channel/:uid/:cid', require('./routes/bilibili/userChannel'));
|
||||
router.get('/bilibili/ranking/:rid?/:day?/:arc_type?/:disableEmbed?', require('./routes/bilibili/ranking'));
|
||||
router.get('/bilibili/user/channel/:uid/:cid/:disableEmbed?', require('./routes/bilibili/userChannel'));
|
||||
router.get('/bilibili/topic/:topic', require('./routes/bilibili/topic'));
|
||||
router.get('/bilibili/audio/:id', require('./routes/bilibili/audio'));
|
||||
router.get('/bilibili/vsearch/:kw/:order?', require('./routes/bilibili/vsearch'));
|
||||
router.get('/bilibili/followings/video/:uid', require('./routes/bilibili/followings_video'));
|
||||
router.get('/bilibili/vsearch/:kw/:order?/:disableEmbed?', require('./routes/bilibili/vsearch'));
|
||||
router.get('/bilibili/followings/video/:uid/:disableEmbed?', require('./routes/bilibili/followings_video'));
|
||||
router.get('/bilibili/followings/article/:uid', require('./routes/bilibili/followings_article'));
|
||||
router.get('/bilibili/readlist/:listid', require('./routes/bilibili/readlist'));
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
const got = require('@/utils/got');
|
||||
const cache = require('./cache');
|
||||
const utils = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const uid = ctx.params.uid;
|
||||
const disableEmbed = ctx.params.disableEmbed;
|
||||
|
||||
const name = await cache.getUsernameFromUID(ctx, uid);
|
||||
|
||||
|
|
@ -21,7 +23,7 @@ module.exports = async (ctx) => {
|
|||
description: `${name} 的 bilibili 投币视频`,
|
||||
item: data.map((item) => ({
|
||||
title: item.title,
|
||||
description: `${item.desc}<br><img src="${item.pic}">`,
|
||||
description: `${item.desc}${!disableEmbed ? `<br><br>${utils.iframe(item.aid)}` : ''}<br><img src="${item.pic}">`,
|
||||
pubDate: new Date(item.time * 1000).toUTCString(),
|
||||
link: `https://www.bilibili.com/video/av${item.aid}`,
|
||||
})),
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
const got = require('@/utils/got');
|
||||
const JSONbig = require('json-bigint');
|
||||
const utils = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const uid = ctx.params.uid;
|
||||
const disableEmbed = ctx.params.disableEmbed;
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
|
|
@ -46,7 +48,9 @@ module.exports = async (ctx) => {
|
|||
|
||||
return {
|
||||
title: data.title || data.description || data.content || (data.vest && data.vest.content),
|
||||
description: `${getDes(data)}${origin ? `<br><br>转发自: @${(origin.user && origin.user.uname) || (origin.owner && origin.owner.name)}: ${getDes(origin.item || origin)}` : ''}${imgHTML} `,
|
||||
description: `${getDes(data)}${origin ? `<br><br>转发自: @${(origin.user && origin.user.uname) || (origin.owner && origin.owner.name)}: ${getDes(origin.item || origin)}` : ''}${
|
||||
!disableEmbed && data.aid ? `<br><br>${utils.iframe(data.aid)}<br>` : ''
|
||||
}<br>${imgHTML} `,
|
||||
pubDate: new Date(item.desc.timestamp * 1000).toUTCString(),
|
||||
link: link,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
const got = require('@/utils/got');
|
||||
const utils = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const fid = ctx.params.fid;
|
||||
const uid = ctx.params.uid;
|
||||
const disableEmbed = ctx.params.disableEmbed;
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
|
|
@ -25,9 +27,9 @@ module.exports = async (ctx) => {
|
|||
data.medias &&
|
||||
data.medias.map((item) => ({
|
||||
title: item.title,
|
||||
description: `${item.intro}`,
|
||||
description: `${item.intro}${!disableEmbed ? `<br><br>${utils.iframe(item.id)}` : ''}`,
|
||||
pubDate: new Date(item.fav_time * 1000).toUTCString(),
|
||||
link: `https://www.bilibili.com/${item.link.replace('bilibili://video/', 'video/av')}`,
|
||||
link: `https://www.bilibili.com/video/av${item.id}`,
|
||||
})),
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
const got = require('@/utils/got');
|
||||
const cache = require('./cache');
|
||||
const config = require('@/config').value;
|
||||
const utils = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const uid = String(ctx.params.uid);
|
||||
const disableEmbed = ctx.params.disableEmbed;
|
||||
const name = await cache.getUsernameFromUID(ctx, uid);
|
||||
|
||||
const cookie = config.bilibili.cookies[uid];
|
||||
|
|
@ -27,7 +29,7 @@ module.exports = async (ctx) => {
|
|||
|
||||
const item = {
|
||||
title: card_data.title,
|
||||
description: `${card_data.desc}<br><img src="${card_data.pic}">`,
|
||||
description: `${card_data.desc}${!disableEmbed ? `<br><br>${utils.iframe(item.aid)}` : ''}<br><img src="${card_data.pic}">`,
|
||||
pubDate: new Date(card_data.pubdate * 1000).toUTCString(),
|
||||
link: `https://www.bilibili.com/video/av${card_data.aid}`,
|
||||
author: card.desc.user_profile.info.uname,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
const got = require('@/utils/got');
|
||||
const utils = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const aid = ctx.params.aid;
|
||||
const disableEmbed = ctx.params.disableEmbed;
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `https://api.bilibili.com/x/web-interface/view?aid=${aid}`,
|
||||
|
|
@ -18,7 +20,7 @@ module.exports = async (ctx) => {
|
|||
description: `视频 ${name} 的视频选集列表`,
|
||||
item: data.map((item) => ({
|
||||
title: item.part,
|
||||
description: `${item.part} - ${name}`,
|
||||
description: `${item.part} - ${name}${!disableEmbed ? `<br><br>${utils.iframe(aid, item.page)}` : ''}`,
|
||||
pubDate: new Date().toUTCString(),
|
||||
link: `https://www.bilibili.com/video/av${aid}?p=${item.page}`,
|
||||
})),
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
const got = require('@/utils/got');
|
||||
const utils = require('./utils');
|
||||
const got_ins = got.extend({
|
||||
headers: {
|
||||
Referer: 'https://www.bilibili.com/',
|
||||
|
|
@ -16,6 +17,7 @@ function formatDate(now) {
|
|||
module.exports = async (ctx) => {
|
||||
const tid = ctx.params.tid;
|
||||
const days = ctx.params.days ? ctx.params.days : 7;
|
||||
const disableEmbed = ctx.params.disableEmbed;
|
||||
|
||||
const responseApi = `https://api.bilibili.com/x/web-interface/newlist?ps=15&rid=${tid}&_=${+new Date()}`;
|
||||
|
||||
|
|
@ -40,7 +42,7 @@ module.exports = async (ctx) => {
|
|||
|
||||
item = {
|
||||
title: `${item.title}`,
|
||||
description: `${item.description}<img src="https:${item.pic}"><br/>Tags:${item.tag}`,
|
||||
description: `${item.description}${!disableEmbed ? `<br><br>${utils.iframe(item.id)}` : ''}<br><img src="https:${item.pic}"><br/>Tags:${item.tag}`,
|
||||
pubDate: new Date(item.pubdate).toUTCString(),
|
||||
link: `https://www.bilibili.com/video/av${item.id}`,
|
||||
author: item.author,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
const got = require('@/utils/got');
|
||||
const utils = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const tid = ctx.params.tid;
|
||||
const disableEmbed = ctx.params.disableEmbed;
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
|
|
@ -25,7 +27,7 @@ module.exports = async (ctx) => {
|
|||
list &&
|
||||
list.map((item) => ({
|
||||
title: `${item.title}`,
|
||||
description: `${item.desc}<img src="${item.pic}">`,
|
||||
description: `${item.desc}${!disableEmbed ? `<br><br>${utils.iframe(item.aid)}` : ''}<br><img src="${item.pic}">`,
|
||||
pubDate: new Date(item.pubdate * 1000).toUTCString(),
|
||||
link: `https://www.bilibili.com/video/av${item.aid}`,
|
||||
author: item.owner.name,
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
const got = require('@/utils/got');
|
||||
const utils = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const rid = ctx.params.rid || '0';
|
||||
const day = ctx.params.day || '3';
|
||||
const arc_type = ctx.params.arc_type || '1';
|
||||
const disableEmbed = ctx.params.disableEmbed;
|
||||
const arc_type1 = arc_type === '0' ? '全部投稿' : '近期投稿';
|
||||
const rid_1 = ['0', '1', '168', '3', '129', '4', '36', '160', '119', '155', '5', '181'];
|
||||
const rid_2 = ['全站', '动画', '国创相关', '音乐', '舞蹈', '游戏', '科技', '生活', '鬼畜', '时尚', '娱乐', '影视'];
|
||||
|
|
@ -40,7 +42,7 @@ module.exports = async (ctx) => {
|
|||
if (data) {
|
||||
return {
|
||||
title: data.title,
|
||||
description: `${data.desc}<br><img src="${data.pic}">`,
|
||||
description: `${data.desc}${!disableEmbed ? `<br><br>${utils.iframe(aid)}` : ''}<br><img src="${data.pic}">`,
|
||||
pubDate: new Date(data.pubdate * 1000).toUTCString(),
|
||||
author: data.owner.name,
|
||||
link: `https://www.bilibili.com/video/av${aid}`,
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
const got = require('@/utils/got');
|
||||
const cache = require('./cache');
|
||||
const utils = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const cid = ctx.params.cid;
|
||||
const uid = ctx.params.uid;
|
||||
const disableEmbed = ctx.params.disableEmbed;
|
||||
|
||||
const userName = await cache.getUsernameFromUID(ctx, uid);
|
||||
const host = `https://api.bilibili.com/x/space/channel/video?mid=${uid}&cid=${cid}&pn=1&ps=10&order=0`;
|
||||
|
|
@ -34,7 +36,7 @@ module.exports = async (ctx) => {
|
|||
|
||||
item: data.archives.map((item) => ({
|
||||
title: item.title,
|
||||
description: `${item.desc}<br><img src="${item.pic}">`,
|
||||
description: `${item.desc}${!disableEmbed ? `<br><br>${utils.iframe(item.aid)}` : ''}<br><img src="${item.pic}">`,
|
||||
pubDate: new Date(item.pubdate * 1000).toUTCString(),
|
||||
link: `https://www.bilibili.com/video/av${item.aid}`,
|
||||
author: userName,
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
const got = require('@/utils/got');
|
||||
const cache = require('./cache');
|
||||
const utils = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const uid = ctx.params.uid;
|
||||
const disableEmbed = ctx.params.disableEmbed;
|
||||
const name = await cache.getUsernameFromUID(ctx, uid);
|
||||
|
||||
const response = await got({
|
||||
|
|
@ -24,7 +26,7 @@ module.exports = async (ctx) => {
|
|||
data.data.archives &&
|
||||
data.data.archives.map((item) => ({
|
||||
title: item.title,
|
||||
description: `${item.desc}<br><img src="${item.pic}">`,
|
||||
description: `${item.desc}${!disableEmbed ? `<br><br>${utils.iframe(item.aid)}` : ''}<br><img src="${item.pic}">`,
|
||||
pubDate: new Date(item.fav_at * 1000).toUTCString(),
|
||||
link: `https://www.bilibili.com/video/av${item.aid}`,
|
||||
})),
|
||||
|
|
|
|||
|
|
@ -1,35 +1,6 @@
|
|||
const got = require('@/utils/got');
|
||||
|
||||
async function load(aid) {
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `https://api.bilibili.com/x/article/archives?ids=${aid}`,
|
||||
});
|
||||
return response.data;
|
||||
}
|
||||
|
||||
const ProcessFeed = async (list, caches) =>
|
||||
await Promise.all(
|
||||
list
|
||||
.filter(async (aid) => {
|
||||
const data = await caches.tryGet('av' + aid, async () => await load(aid));
|
||||
return data.code === 0;
|
||||
})
|
||||
.map(async (aid) => {
|
||||
let data = await caches.tryGet('av' + aid, async () => await load(aid));
|
||||
data = data.data[aid + ''];
|
||||
const single = {
|
||||
title: data.title,
|
||||
description: `${data.desc}<br><img src="${data.pic}">`,
|
||||
pubDate: new Date(data.pubdate * 1000).toUTCString(),
|
||||
author: data.owner.name,
|
||||
link: `https://www.bilibili.com/video/av${aid}`,
|
||||
guid: `https://www.bilibili.com/video/av${aid}`,
|
||||
};
|
||||
return Promise.resolve(single);
|
||||
})
|
||||
);
|
||||
const iframe = (aid, page) =>
|
||||
`<iframe src="https://player.bilibili.com/player.html?aid=${aid}${page ? `&page=${page}` : ''}" width="650" height="477" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"></iframe>`;
|
||||
|
||||
module.exports = {
|
||||
ProcessFeed,
|
||||
iframe,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
const got = require('@/utils/got');
|
||||
const cache = require('./cache');
|
||||
const utils = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const uid = ctx.params.uid;
|
||||
const disableEmbed = ctx.params.disableEmbed;
|
||||
const name = await cache.getUsernameFromUID(ctx, uid);
|
||||
|
||||
const response = await got({
|
||||
|
|
@ -23,7 +25,7 @@ module.exports = async (ctx) => {
|
|||
data.data.vlist &&
|
||||
data.data.vlist.map((item) => ({
|
||||
title: item.title,
|
||||
description: `${item.description}<br><img src="https:${item.pic}">`,
|
||||
description: `${item.description}${!disableEmbed ? `<br><br>${utils.iframe(item.aid)}` : ''}<br><img src="https:${item.pic}">`,
|
||||
pubDate: new Date(item.created * 1000).toUTCString(),
|
||||
link: `https://www.bilibili.com/video/av${item.aid}`,
|
||||
author: name,
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
const got = require('@/utils/got');
|
||||
const utils = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const kw = ctx.params.kw;
|
||||
const order = ctx.params.order || 'pubdate';
|
||||
const disableEmbed = ctx.params.disableEmbed;
|
||||
const kw_url = encodeURIComponent(kw);
|
||||
|
||||
const response = await got({
|
||||
|
|
@ -39,7 +41,8 @@ module.exports = async (ctx) => {
|
|||
`<br/>${des}<br/>` +
|
||||
`<img src="${img}"><br/>` +
|
||||
`Tag: ${item.tag}<br/>` +
|
||||
`Match By: ${item.hit_columns.join(',')}`,
|
||||
`Match By: ${item.hit_columns.join(',')}` +
|
||||
(!disableEmbed ? `<br><br>${utils.iframe(item.aid)}` : ''),
|
||||
pubDate: new Date(item.pubdate * 1000).toUTCString(),
|
||||
guid: `${item.arcurl}`,
|
||||
link: `${item.arcurl}`,
|
||||
|
|
|
|||
Loading…
Reference in New Issue