rsshub 1.0.0-master.b76ffa1 → 1.0.0-master.b77ea8a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/config.ts +3 -0
- package/lib/middleware/access-control.ts +1 -1
- package/lib/routes/afdian/dynamic.ts +1 -1
- package/lib/routes/afdian/explore.ts +1 -1
- package/lib/routes/bilibili/bangumi.ts +45 -43
- package/lib/routes/bilibili/bilibili-recommend.ts +4 -4
- package/lib/routes/bilibili/coin.ts +4 -4
- package/lib/routes/bilibili/dynamic.ts +14 -14
- package/lib/routes/bilibili/fav.ts +4 -4
- package/lib/routes/bilibili/followings-dynamic.ts +25 -3
- package/lib/routes/bilibili/followings-video.ts +4 -4
- package/lib/routes/bilibili/like.ts +4 -4
- package/lib/routes/bilibili/page.ts +5 -4
- package/lib/routes/bilibili/partion-ranking.ts +4 -4
- package/lib/routes/bilibili/partion.ts +4 -4
- package/lib/routes/bilibili/popular.ts +6 -4
- package/lib/routes/bilibili/ranking.ts +4 -6
- package/lib/routes/bilibili/templates/description.art +12 -0
- package/lib/routes/bilibili/types.ts +52 -0
- package/lib/routes/bilibili/user-channel.ts +10 -17
- package/lib/routes/bilibili/user-collection.ts +10 -18
- package/lib/routes/bilibili/user-fav.ts +4 -4
- package/lib/routes/bilibili/utils.ts +111 -7
- package/lib/routes/bilibili/video-all.ts +8 -3
- package/lib/routes/bilibili/video.ts +5 -4
- package/lib/routes/bilibili/vsearch.ts +21 -5
- package/lib/routes/bilibili/watchlater.ts +4 -4
- package/lib/routes/bilibili/weekly-recommend.ts +4 -9
- package/lib/routes/bsky/posts.ts +2 -2
- package/lib/routes/bsky/templates/post.art +4 -2
- package/lib/routes/chinania/index.ts +240 -0
- package/lib/routes/chinania/namespace.ts +8 -0
- package/lib/routes/dedao/articles.ts +149 -0
- package/lib/routes/eshukan/academic.ts +134 -0
- package/lib/routes/eshukan/namespace.ts +8 -0
- package/lib/routes/eshukan/templates/description.art +7 -0
- package/lib/routes/follow/profile.ts +37 -3
- package/lib/routes/lovelive-anime/schedules.ts +4 -5
- package/lib/routes/lovelive-anime/topics.ts +88 -37
- package/lib/routes/mingpao/index.ts +7 -1
- package/lib/routes/nature/cover.ts +5 -3
- package/lib/routes/nature/research.ts +1 -1
- package/lib/routes/nature/siteindex.ts +25 -11
- package/lib/routes/nature/utils.ts +5 -7
- package/lib/routes/qq/pd/guild.ts +146 -0
- package/lib/routes/qq/pd/types.ts +82 -0
- package/lib/routes/qq/pd/utils.ts +119 -0
- package/lib/routes/reuters/common.ts +160 -159
- package/lib/routes/reuters/investigates.ts +3 -2
- package/lib/routes/rsshub/transform/html.ts +2 -2
- package/lib/routes/telegram/channel.ts +14 -5
- package/lib/routes/telegram/scripts/get-telegram-session.mjs +41 -0
- package/lib/routes/telegram/tglib/channel.ts +8 -4
- package/lib/routes/theinitium/app.ts +49 -27
- package/lib/routes/theinitium/templates/description.art +2 -2
- package/lib/routes/threads/index.ts +1 -1
- package/lib/routes/threads/utils.ts +19 -1
- package/lib/routes/twitter/api/mobile-api/login.ts +125 -127
- package/lib/routes/twitter/api/mobile-api/token.ts +2 -0
- package/lib/routes/twitter/home-latest.ts +4 -1
- package/lib/routes/twitter/home.ts +4 -1
- package/lib/routes/twitter/likes.ts +4 -1
- package/lib/routes/twitter/list.ts +4 -1
- package/lib/routes/twitter/namespace.ts +1 -0
- package/lib/routes/twitter/utils.ts +9 -3
- package/lib/routes/warthunder/news.ts +8 -8
- package/lib/routes/washingtonpost/app.ts +118 -0
- package/lib/routes/washingtonpost/namespace.ts +6 -0
- package/lib/routes/washingtonpost/templates/description.art +59 -0
- package/lib/routes/zhihu/daily.ts +30 -64
- package/package.json +12 -12
package/lib/config.ts
CHANGED
|
@@ -286,6 +286,7 @@ export type Config = {
|
|
|
286
286
|
};
|
|
287
287
|
telegram: {
|
|
288
288
|
token?: string;
|
|
289
|
+
session?: string;
|
|
289
290
|
};
|
|
290
291
|
tophub: {
|
|
291
292
|
cookie?: string;
|
|
@@ -297,6 +298,7 @@ export type Config = {
|
|
|
297
298
|
username?: string[];
|
|
298
299
|
password?: string[];
|
|
299
300
|
authenticationSecret?: string[];
|
|
301
|
+
phoneOrEmail?: string[];
|
|
300
302
|
authToken?: string[];
|
|
301
303
|
};
|
|
302
304
|
uestc: {
|
|
@@ -700,6 +702,7 @@ const calculateValue = () => {
|
|
|
700
702
|
username: envs.TWITTER_USERNAME?.split(','),
|
|
701
703
|
password: envs.TWITTER_PASSWORD?.split(','),
|
|
702
704
|
authenticationSecret: envs.TWITTER_AUTHENTICATION_SECRET?.split(','),
|
|
705
|
+
phoneOrEmail: envs.TWITTER_PHONE_OR_EMAIL?.split(','),
|
|
703
706
|
authToken: envs.TWITTER_AUTH_TOKEN?.split(','),
|
|
704
707
|
},
|
|
705
708
|
uestc: {
|
|
@@ -8,7 +8,7 @@ const reject = () => {
|
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
const middleware: MiddlewareHandler = async (ctx, next) => {
|
|
11
|
-
const requestPath = ctx.req.
|
|
11
|
+
const requestPath = new URL(ctx.req.url).pathname;
|
|
12
12
|
const accessKey = ctx.req.query('key');
|
|
13
13
|
const accessCode = ctx.req.query('code');
|
|
14
14
|
|
|
@@ -13,7 +13,7 @@ export const route: Route = {
|
|
|
13
13
|
|
|
14
14
|
async function handler(ctx) {
|
|
15
15
|
const url_slug = ctx.req.param('uid').replace('@', '');
|
|
16
|
-
const baseUrl = 'https://afdian.
|
|
16
|
+
const baseUrl = 'https://afdian.com';
|
|
17
17
|
const userInfoRes = await got(`${baseUrl}/api/user/get-profile-by-slug`, {
|
|
18
18
|
searchParams: {
|
|
19
19
|
url_slug,
|
|
@@ -49,7 +49,7 @@ export const route: Route = {
|
|
|
49
49
|
|
|
50
50
|
async function handler(ctx) {
|
|
51
51
|
const { type = 'rec', category = '所有' } = ctx.req.param();
|
|
52
|
-
const baseUrl = 'https://afdian.
|
|
52
|
+
const baseUrl = 'https://afdian.com';
|
|
53
53
|
const link = `${baseUrl}/api/creator/list`;
|
|
54
54
|
const res = await got(link, {
|
|
55
55
|
searchParams: {
|
|
@@ -1,66 +1,68 @@
|
|
|
1
|
-
import { Route, ViewType } from '@/types';
|
|
2
|
-
import
|
|
1
|
+
import { Data, DataItem, Route, ViewType } from '@/types';
|
|
2
|
+
import cache from '@/utils/cache';
|
|
3
|
+
import { EpisodeResult } from './types';
|
|
4
|
+
import utils from './utils';
|
|
3
5
|
|
|
4
6
|
export const route: Route = {
|
|
5
|
-
path: '/bangumi/media/:mediaid',
|
|
7
|
+
path: '/bangumi/media/:mediaid/:embed?',
|
|
6
8
|
name: '番剧',
|
|
7
9
|
parameters: {
|
|
8
10
|
mediaid: '番剧媒体 id, 番剧主页 URL 中获取',
|
|
11
|
+
embed: '默认为开启内嵌视频, 任意值为关闭',
|
|
9
12
|
},
|
|
10
13
|
example: '/bilibili/bangumi/media/9192',
|
|
11
14
|
categories: ['social-media', 'popular'],
|
|
12
15
|
view: ViewType.Videos,
|
|
13
|
-
maintainers: ['DIYgod'],
|
|
16
|
+
maintainers: ['DIYgod', 'nuomi1'],
|
|
14
17
|
handler,
|
|
18
|
+
features: {
|
|
19
|
+
requireConfig: false,
|
|
20
|
+
requirePuppeteer: false,
|
|
21
|
+
antiCrawler: true,
|
|
22
|
+
supportRadar: false,
|
|
23
|
+
supportBT: false,
|
|
24
|
+
supportPodcast: false,
|
|
25
|
+
supportScihub: false,
|
|
26
|
+
},
|
|
15
27
|
};
|
|
16
28
|
|
|
17
29
|
async function handler(ctx) {
|
|
18
|
-
|
|
19
|
-
const
|
|
30
|
+
const mediaId = ctx.req.param('mediaid');
|
|
31
|
+
const embed = !ctx.req.param('embed');
|
|
20
32
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
33
|
+
const mediaData = await utils.getBangumi(mediaId, cache);
|
|
34
|
+
const seasonId = String(mediaData.season_id);
|
|
35
|
+
const seasonData = await utils.getBangumiItems(seasonId, cache);
|
|
36
|
+
|
|
37
|
+
const episodes: DataItem[] = [];
|
|
38
|
+
|
|
39
|
+
const getEpisode = (item: EpisodeResult, title: string) =>
|
|
40
|
+
({
|
|
41
|
+
title,
|
|
42
|
+
description: utils.renderOGVDescription(embed, item.cover, item.long_title, seasonId, String(item.id)),
|
|
43
|
+
link: item.share_url,
|
|
44
|
+
image: item.cover.replace('http://', 'https://'),
|
|
45
|
+
language: 'zh-cn',
|
|
46
|
+
}) as DataItem;
|
|
31
47
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
episodes
|
|
35
|
-
...episodes,
|
|
36
|
-
...data.result.main_section.episodes.map((item) => ({
|
|
37
|
-
title: `第${item.title}话 ${item.long_title}`,
|
|
38
|
-
description: `<img src="${item.cover}">`,
|
|
39
|
-
link: `https://www.bilibili.com/bangumi/play/ep${item.id}`,
|
|
40
|
-
})),
|
|
41
|
-
];
|
|
48
|
+
for (const item of seasonData.main_section.episodes) {
|
|
49
|
+
const episode = getEpisode(item, `第${item.title}话 ${item.long_title}`);
|
|
50
|
+
episodes.push(episode);
|
|
42
51
|
}
|
|
43
52
|
|
|
44
|
-
|
|
45
|
-
for (const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
...episodes,
|
|
49
|
-
...section.episodes.map((item) => ({
|
|
50
|
-
title: `${item.title} ${item.long_title}`,
|
|
51
|
-
description: `<img src="${item.cover}">`,
|
|
52
|
-
link: `https://www.bilibili.com/bangumi/play/ep${item.id}`,
|
|
53
|
-
})),
|
|
54
|
-
];
|
|
55
|
-
}
|
|
53
|
+
for (const section of seasonData.section) {
|
|
54
|
+
for (const item of section.episodes) {
|
|
55
|
+
const episode = getEpisode(item, `${item.title} ${item.long_title}`);
|
|
56
|
+
episodes.push(episode);
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
return {
|
|
60
|
-
title: mediaData
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
description: mediaData?.mediaInfo.evaluate,
|
|
61
|
+
title: mediaData.title,
|
|
62
|
+
description: mediaData.evaluate,
|
|
63
|
+
link: mediaData.share_url,
|
|
64
64
|
item: episodes,
|
|
65
|
-
|
|
65
|
+
image: mediaData.cover.replace('http://', 'https://'),
|
|
66
|
+
language: 'zh-cn',
|
|
67
|
+
} as Data;
|
|
66
68
|
}
|
|
@@ -3,10 +3,10 @@ import got from '@/utils/got';
|
|
|
3
3
|
import utils from './utils';
|
|
4
4
|
|
|
5
5
|
export const route: Route = {
|
|
6
|
-
path: '/precious/:
|
|
6
|
+
path: '/precious/:embed?',
|
|
7
7
|
categories: ['social-media'],
|
|
8
8
|
example: '/bilibili/precious',
|
|
9
|
-
parameters: {
|
|
9
|
+
parameters: { embed: '默认为开启内嵌视频, 任意值为关闭' },
|
|
10
10
|
features: {
|
|
11
11
|
requireConfig: false,
|
|
12
12
|
requirePuppeteer: false,
|
|
@@ -21,7 +21,7 @@ export const route: Route = {
|
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
async function handler(ctx) {
|
|
24
|
-
const
|
|
24
|
+
const embed = !ctx.req.param('embed');
|
|
25
25
|
const response = await got({
|
|
26
26
|
method: 'get',
|
|
27
27
|
url: 'https://api.bilibili.com/x/web-interface/popular/precious',
|
|
@@ -35,7 +35,7 @@ async function handler(ctx) {
|
|
|
35
35
|
link: 'https://www.bilibili.com/v/popular/history',
|
|
36
36
|
item: data.map((item) => ({
|
|
37
37
|
title: item.title,
|
|
38
|
-
description:
|
|
38
|
+
description: utils.renderUGCDescription(embed, item.pic, item.desc || item.title, item.aid, undefined, item.bvid),
|
|
39
39
|
link: item.bvid ? `https://www.bilibili.com/video/${item.bvid}` : `https://www.bilibili.com/video/av${item.aid}`,
|
|
40
40
|
})),
|
|
41
41
|
};
|
|
@@ -5,10 +5,10 @@ import utils from './utils';
|
|
|
5
5
|
import { parseDate } from '@/utils/parse-date';
|
|
6
6
|
|
|
7
7
|
export const route: Route = {
|
|
8
|
-
path: '/user/coin/:uid/:
|
|
8
|
+
path: '/user/coin/:uid/:embed?',
|
|
9
9
|
categories: ['social-media'],
|
|
10
10
|
example: '/bilibili/user/coin/208259',
|
|
11
|
-
parameters: { uid: '用户 id, 可在 UP 主主页中找到',
|
|
11
|
+
parameters: { uid: '用户 id, 可在 UP 主主页中找到', embed: '默认为开启内嵌视频, 任意值为关闭' },
|
|
12
12
|
features: {
|
|
13
13
|
requireConfig: false,
|
|
14
14
|
requirePuppeteer: false,
|
|
@@ -30,7 +30,7 @@ export const route: Route = {
|
|
|
30
30
|
|
|
31
31
|
async function handler(ctx) {
|
|
32
32
|
const uid = ctx.req.param('uid');
|
|
33
|
-
const
|
|
33
|
+
const embed = !ctx.req.param('embed');
|
|
34
34
|
|
|
35
35
|
const name = await cache.getUsernameFromUID(uid);
|
|
36
36
|
|
|
@@ -51,7 +51,7 @@ async function handler(ctx) {
|
|
|
51
51
|
description: `${name} 的 bilibili 投币视频`,
|
|
52
52
|
item: data.map((item) => ({
|
|
53
53
|
title: item.title,
|
|
54
|
-
description:
|
|
54
|
+
description: utils.renderUGCDescription(embed, item.pic, item.desc, item.aid, undefined, item.bvid),
|
|
55
55
|
pubDate: parseDate(item.time * 1000),
|
|
56
56
|
link: item.time > utils.bvidTime && item.bvid ? `https://www.bilibili.com/video/${item.bvid}` : `https://www.bilibili.com/video/av${item.aid}`,
|
|
57
57
|
author: item.owner.name,
|
|
@@ -16,15 +16,15 @@ export const route: Route = {
|
|
|
16
16
|
parameters: {
|
|
17
17
|
uid: '用户 id, 可在 UP 主主页中找到',
|
|
18
18
|
routeParams: `
|
|
19
|
-
| 键
|
|
20
|
-
|
|
|
21
|
-
| showEmoji
|
|
22
|
-
|
|
|
23
|
-
| useAvid
|
|
24
|
-
| directLink
|
|
25
|
-
| hideGoods
|
|
19
|
+
| 键 | 含义 | 接受的值 | 默认值 |
|
|
20
|
+
| ---------- | --------------------------------- | -------------- | ------ |
|
|
21
|
+
| showEmoji | 显示或隐藏表情图片 | 0/1/true/false | false |
|
|
22
|
+
| embed | 默认开启内嵌视频 | 任意值 | |
|
|
23
|
+
| useAvid | 视频链接使用 AV 号 (默认为 BV 号) | 0/1/true/false | false |
|
|
24
|
+
| directLink | 使用内容直链 | 0/1/true/false | false |
|
|
25
|
+
| hideGoods | 隐藏带货动态 | 0/1/true/false | false |
|
|
26
26
|
|
|
27
|
-
用例:\`/bilibili/user/dynamic/2267573/showEmoji=1&
|
|
27
|
+
用例:\`/bilibili/user/dynamic/2267573/showEmoji=1&embed=0&useAvid=1\``,
|
|
28
28
|
},
|
|
29
29
|
features: {
|
|
30
30
|
requireConfig: [
|
|
@@ -108,16 +108,16 @@ const getDes = (data: Modules): string => {
|
|
|
108
108
|
const getOriginTitle = (data?: Modules) => data && getTitle(data);
|
|
109
109
|
const getOriginDes = (data?: Modules) => data && getDes(data);
|
|
110
110
|
const getOriginName = (data?: Modules) => data?.module_author?.name;
|
|
111
|
-
const getIframe = (data?: Modules,
|
|
112
|
-
if (
|
|
111
|
+
const getIframe = (data?: Modules, embed: boolean = true) => {
|
|
112
|
+
if (!embed) {
|
|
113
113
|
return '';
|
|
114
114
|
}
|
|
115
115
|
const aid = data?.module_dynamic?.major?.archive?.aid;
|
|
116
116
|
const bvid = data?.module_dynamic?.major?.archive?.bvid;
|
|
117
|
-
if (
|
|
117
|
+
if (aid === undefined && bvid === undefined) {
|
|
118
118
|
return '';
|
|
119
119
|
}
|
|
120
|
-
return utils.
|
|
120
|
+
return utils.renderUGCDescription(embed, '', '', aid, undefined, bvid);
|
|
121
121
|
};
|
|
122
122
|
|
|
123
123
|
const getImgs = (data?: Modules) => {
|
|
@@ -226,7 +226,7 @@ async function handler(ctx) {
|
|
|
226
226
|
const uid = ctx.req.param('uid');
|
|
227
227
|
const routeParams = Object.fromEntries(new URLSearchParams(ctx.req.param('routeParams')));
|
|
228
228
|
const showEmoji = fallback(undefined, queryToBoolean(routeParams.showEmoji), false);
|
|
229
|
-
const
|
|
229
|
+
const embed = !ctx.req.param('embed');
|
|
230
230
|
const displayArticle = ctx.req.query('mode') === 'fulltext';
|
|
231
231
|
const useAvid = fallback(undefined, queryToBoolean(routeParams.useAvid), false);
|
|
232
232
|
const directLink = fallback(undefined, queryToBoolean(routeParams.directLink), false);
|
|
@@ -356,7 +356,7 @@ async function handler(ctx) {
|
|
|
356
356
|
description = description.replaceAll('\r\n', '<br>').replaceAll('\n', '<br>');
|
|
357
357
|
originDescription = originDescription.replaceAll('\r\n', '<br>').replaceAll('\n', '<br>');
|
|
358
358
|
|
|
359
|
-
const descriptions = [description, originDescription, urlText, originUrlText, getIframe(data,
|
|
359
|
+
const descriptions = [description, originDescription, urlText, originUrlText, getIframe(data, embed), getIframe(origin, embed), getImgs(data), getImgs(origin)]
|
|
360
360
|
.filter(Boolean)
|
|
361
361
|
.map((e) => e?.trim())
|
|
362
362
|
.join('<br>');
|
|
@@ -5,10 +5,10 @@ import { parseDate } from '@/utils/parse-date';
|
|
|
5
5
|
import { config } from '@/config';
|
|
6
6
|
|
|
7
7
|
export const route: Route = {
|
|
8
|
-
path: '/fav/:uid/:fid/:
|
|
8
|
+
path: '/fav/:uid/:fid/:embed?',
|
|
9
9
|
categories: ['social-media'],
|
|
10
10
|
example: '/bilibili/fav/756508/50948568',
|
|
11
|
-
parameters: { uid: '用户 id, 可在 UP 主主页中找到', fid: '收藏夹 ID, 可在收藏夹的 URL 中找到, 默认收藏夹建议使用 UP 主默认收藏夹功能',
|
|
11
|
+
parameters: { uid: '用户 id, 可在 UP 主主页中找到', fid: '收藏夹 ID, 可在收藏夹的 URL 中找到, 默认收藏夹建议使用 UP 主默认收藏夹功能', embed: '默认为开启内嵌视频, 任意值为关闭' },
|
|
12
12
|
features: {
|
|
13
13
|
requireConfig: false,
|
|
14
14
|
requirePuppeteer: false,
|
|
@@ -25,7 +25,7 @@ export const route: Route = {
|
|
|
25
25
|
async function handler(ctx) {
|
|
26
26
|
const fid = ctx.req.param('fid');
|
|
27
27
|
const uid = ctx.req.param('uid');
|
|
28
|
-
const
|
|
28
|
+
const embed = !ctx.req.param('embed');
|
|
29
29
|
|
|
30
30
|
const response = await got({
|
|
31
31
|
url: `https://api.bilibili.com/x/v3/fav/resource/list?media_id=${fid}&ps=20`,
|
|
@@ -51,7 +51,7 @@ async function handler(ctx) {
|
|
|
51
51
|
data.medias &&
|
|
52
52
|
data.medias.map((item) => ({
|
|
53
53
|
title: item.title,
|
|
54
|
-
description:
|
|
54
|
+
description: utils.renderUGCDescription(embed, item.cover, item.intro, item.id, undefined, item.bvid),
|
|
55
55
|
pubDate: parseDate(item.fav_time * 1000),
|
|
56
56
|
link: item.fav_time > utils.bvidTime && item.bvid ? `https://www.bilibili.com/video/${item.bvid}` : `https://www.bilibili.com/video/av${item.id}`,
|
|
57
57
|
author: item.upper.name,
|
|
@@ -12,7 +12,19 @@ export const route: Route = {
|
|
|
12
12
|
path: '/followings/dynamic/:uid/:routeParams?',
|
|
13
13
|
categories: ['social-media'],
|
|
14
14
|
example: '/bilibili/followings/dynamic/109937383',
|
|
15
|
-
parameters: {
|
|
15
|
+
parameters: {
|
|
16
|
+
uid: '用户 id, 可在 UP 主主页中找到',
|
|
17
|
+
routeParams: `
|
|
18
|
+
| 键 | 含义 | 接受的值 | 默认值 |
|
|
19
|
+
| ---------- | --------------------------------- | -------------- | ------ |
|
|
20
|
+
| showEmoji | 显示或隐藏表情图片 | 0/1/true/false | false |
|
|
21
|
+
| embed | 默认开启内嵌视频 | 任意值 | |
|
|
22
|
+
| useAvid | 视频链接使用 AV 号 (默认为 BV 号) | 0/1/true/false | false |
|
|
23
|
+
| directLink | 使用内容直链 | 0/1/true/false | false |
|
|
24
|
+
| hideGoods | 隐藏带货动态 | 0/1/true/false | false |
|
|
25
|
+
|
|
26
|
+
用例:\`/bilibili/followings/dynamic/2267573/showEmoji=1&embed=0&useAvid=1\``,
|
|
27
|
+
},
|
|
16
28
|
features: {
|
|
17
29
|
requireConfig: [
|
|
18
30
|
{
|
|
@@ -43,7 +55,7 @@ async function handler(ctx) {
|
|
|
43
55
|
const routeParams = querystring.parse(ctx.req.param('routeParams'));
|
|
44
56
|
|
|
45
57
|
const showEmoji = fallback(undefined, queryToBoolean(routeParams.showEmoji), false);
|
|
46
|
-
const
|
|
58
|
+
const embed = !ctx.req.param('embed');
|
|
47
59
|
const displayArticle = fallback(undefined, queryToBoolean(routeParams.displayArticle), false);
|
|
48
60
|
|
|
49
61
|
const name = await cache.getUsernameFromUID(uid);
|
|
@@ -74,7 +86,17 @@ async function handler(ctx) {
|
|
|
74
86
|
const getOriginDes = (data) => (data && (data.apiSeasonInfo && data.apiSeasonInfo.title && `//转发自: ${data.apiSeasonInfo.title}`) + (data.index_title && `<br>${data.index_title}`)) || '';
|
|
75
87
|
const getOriginName = (data) => data.uname || (data.author && data.author.name) || (data.upper && data.upper.name) || (data.user && (data.user.uname || data.user.name)) || (data.owner && data.owner.name) || '';
|
|
76
88
|
const getOriginTitle = (data) => (data.title ? `${data.title}<br>` : '');
|
|
77
|
-
const getIframe = (data) =>
|
|
89
|
+
const getIframe = (data) => {
|
|
90
|
+
if (!embed) {
|
|
91
|
+
return '';
|
|
92
|
+
}
|
|
93
|
+
const aid = data?.aid;
|
|
94
|
+
const bvid = data?.bvid;
|
|
95
|
+
if (aid === undefined && bvid === undefined) {
|
|
96
|
+
return '';
|
|
97
|
+
}
|
|
98
|
+
return utils.renderUGCDescription(embed, '', '', aid, undefined, bvid);
|
|
99
|
+
};
|
|
78
100
|
const getImgs = (data) => {
|
|
79
101
|
let imgs = '';
|
|
80
102
|
// 动态图片
|
|
@@ -7,10 +7,10 @@ import ConfigNotFoundError from '@/errors/types/config-not-found';
|
|
|
7
7
|
import logger from '@/utils/logger';
|
|
8
8
|
|
|
9
9
|
export const route: Route = {
|
|
10
|
-
path: '/followings/video/:uid/:
|
|
10
|
+
path: '/followings/video/:uid/:embed?',
|
|
11
11
|
categories: ['social-media'],
|
|
12
12
|
example: '/bilibili/followings/video/2267573',
|
|
13
|
-
parameters: { uid: '用户 id',
|
|
13
|
+
parameters: { uid: '用户 id', embed: '默认为开启内嵌视频, 任意值为关闭' },
|
|
14
14
|
features: {
|
|
15
15
|
requireConfig: [
|
|
16
16
|
{
|
|
@@ -38,7 +38,7 @@ export const route: Route = {
|
|
|
38
38
|
|
|
39
39
|
async function handler(ctx) {
|
|
40
40
|
const uid = String(ctx.req.param('uid'));
|
|
41
|
-
const
|
|
41
|
+
const embed = !ctx.req.param('embed');
|
|
42
42
|
const name = await cache.getUsernameFromUID(uid);
|
|
43
43
|
|
|
44
44
|
const cookie = config.bilibili.cookies[uid];
|
|
@@ -69,7 +69,7 @@ async function handler(ctx) {
|
|
|
69
69
|
|
|
70
70
|
return {
|
|
71
71
|
title: card_data.title,
|
|
72
|
-
description:
|
|
72
|
+
description: utils.renderUGCDescription(embed, card_data.pic, card_data.desc, card_data.aid, undefined, card_data.bvid),
|
|
73
73
|
pubDate: new Date(card_data.pubdate * 1000).toUTCString(),
|
|
74
74
|
link: card_data.pubdate > utils.bvidTime && card_data.bvid ? `https://www.bilibili.com/video/${card_data.bvid}` : `https://www.bilibili.com/video/av${card_data.aid}`,
|
|
75
75
|
author: card.desc.user_profile.info.uname,
|
|
@@ -5,10 +5,10 @@ import utils from './utils';
|
|
|
5
5
|
import { parseDate } from '@/utils/parse-date';
|
|
6
6
|
|
|
7
7
|
export const route: Route = {
|
|
8
|
-
path: '/user/like/:uid/:
|
|
8
|
+
path: '/user/like/:uid/:embed?',
|
|
9
9
|
categories: ['social-media'],
|
|
10
10
|
example: '/bilibili/user/like/208259',
|
|
11
|
-
parameters: { uid: '用户 id, 可在 UP 主主页中找到',
|
|
11
|
+
parameters: { uid: '用户 id, 可在 UP 主主页中找到', embed: '默认为开启内嵌视频, 任意值为关闭' },
|
|
12
12
|
features: {
|
|
13
13
|
requireConfig: false,
|
|
14
14
|
requirePuppeteer: false,
|
|
@@ -30,7 +30,7 @@ export const route: Route = {
|
|
|
30
30
|
|
|
31
31
|
async function handler(ctx) {
|
|
32
32
|
const uid = ctx.req.param('uid');
|
|
33
|
-
const
|
|
33
|
+
const embed = !ctx.req.param('embed');
|
|
34
34
|
|
|
35
35
|
const name = await cache.getUsernameFromUID(uid);
|
|
36
36
|
|
|
@@ -51,7 +51,7 @@ async function handler(ctx) {
|
|
|
51
51
|
description: `${name} 的 bilibili 点赞视频`,
|
|
52
52
|
item: data.list.map((item) => ({
|
|
53
53
|
title: item.title,
|
|
54
|
-
description:
|
|
54
|
+
description: utils.renderUGCDescription(embed, item.pic, item.desc, item.aid, undefined, item.bvid),
|
|
55
55
|
pubDate: parseDate(item.pubdate * 1000),
|
|
56
56
|
link: item.pubdate > utils.bvidTime && item.bvid ? `https://www.bilibili.com/video/${item.bvid}` : `https://www.bilibili.com/video/av${item.aid}`,
|
|
57
57
|
author: item.owner.name,
|
|
@@ -3,10 +3,10 @@ import got from '@/utils/got';
|
|
|
3
3
|
import utils from './utils';
|
|
4
4
|
|
|
5
5
|
export const route: Route = {
|
|
6
|
-
path: '/video/page/:bvid/:
|
|
6
|
+
path: '/video/page/:bvid/:embed?',
|
|
7
7
|
categories: ['social-media'],
|
|
8
8
|
example: '/bilibili/video/page/BV1i7411M7N9',
|
|
9
|
-
parameters: { bvid: '可在视频页 URL 中找到',
|
|
9
|
+
parameters: { bvid: '可在视频页 URL 中找到', embed: '默认为开启内嵌视频, 任意值为关闭' },
|
|
10
10
|
features: {
|
|
11
11
|
requireConfig: false,
|
|
12
12
|
requirePuppeteer: false,
|
|
@@ -27,7 +27,7 @@ async function handler(ctx) {
|
|
|
27
27
|
aid = bvid;
|
|
28
28
|
bvid = null;
|
|
29
29
|
}
|
|
30
|
-
const
|
|
30
|
+
const embed = !ctx.req.param('embed');
|
|
31
31
|
const link = `https://www.bilibili.com/video/${bvid || `av${aid}`}`;
|
|
32
32
|
const response = await got({
|
|
33
33
|
method: 'get',
|
|
@@ -37,6 +37,7 @@ async function handler(ctx) {
|
|
|
37
37
|
},
|
|
38
38
|
});
|
|
39
39
|
|
|
40
|
+
const respdata = response.data.data;
|
|
40
41
|
const { title: name, pages: data } = response.data.data;
|
|
41
42
|
|
|
42
43
|
return {
|
|
@@ -48,7 +49,7 @@ async function handler(ctx) {
|
|
|
48
49
|
.slice(0, ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : 10)
|
|
49
50
|
.map((item) => ({
|
|
50
51
|
title: item.part,
|
|
51
|
-
description: `${item.part} - ${name}
|
|
52
|
+
description: utils.renderUGCDescription(embed, respdata.pic, `${item.part} - ${name}`, respdata.aid, item.cid, respdata.bvid),
|
|
52
53
|
link: `${link}?p=${item.page}`,
|
|
53
54
|
})),
|
|
54
55
|
};
|
|
@@ -16,10 +16,10 @@ function formatDate(now) {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export const route: Route = {
|
|
19
|
-
path: '/partion/ranking/:tid/:days?/:
|
|
19
|
+
path: '/partion/ranking/:tid/:days?/:embed?',
|
|
20
20
|
categories: ['social-media'],
|
|
21
21
|
example: '/bilibili/partion/ranking/171/3',
|
|
22
|
-
parameters: { tid: '分区 id, 见上方表格', days: '缺省为 7, 指最近多少天内的热度排序',
|
|
22
|
+
parameters: { tid: '分区 id, 见上方表格', days: '缺省为 7, 指最近多少天内的热度排序', embed: '默认为开启内嵌视频, 任意值为关闭' },
|
|
23
23
|
features: {
|
|
24
24
|
requireConfig: false,
|
|
25
25
|
requirePuppeteer: false,
|
|
@@ -36,7 +36,7 @@ export const route: Route = {
|
|
|
36
36
|
async function handler(ctx) {
|
|
37
37
|
const tid = ctx.req.param('tid');
|
|
38
38
|
const days = ctx.req.param('days') ?? 7;
|
|
39
|
-
const
|
|
39
|
+
const embed = !ctx.req.param('embed');
|
|
40
40
|
|
|
41
41
|
const responseApi = `https://api.bilibili.com/x/web-interface/newlist?ps=15&rid=${tid}&_=${Date.now()}`;
|
|
42
42
|
|
|
@@ -59,7 +59,7 @@ async function handler(ctx) {
|
|
|
59
59
|
for (let item of hotlist) {
|
|
60
60
|
item = {
|
|
61
61
|
title: item.title,
|
|
62
|
-
description: `${item.description}
|
|
62
|
+
description: utils.renderUGCDescription(embed, item.pic, `${item.description} - ${item.tag}`, item.id, undefined, item.bvid),
|
|
63
63
|
pubDate: new Date(item.pubdate).toUTCString(),
|
|
64
64
|
link: item.pubdate > utils.bvidTime && item.bvid ? `https://www.bilibili.com/video/${item.bvid}` : `https://www.bilibili.com/video/av${item.id}`,
|
|
65
65
|
author: item.author,
|
|
@@ -3,10 +3,10 @@ import got from '@/utils/got';
|
|
|
3
3
|
import utils from './utils';
|
|
4
4
|
|
|
5
5
|
export const route: Route = {
|
|
6
|
-
path: '/partion/:tid/:
|
|
6
|
+
path: '/partion/:tid/:embed?',
|
|
7
7
|
categories: ['social-media'],
|
|
8
8
|
example: '/bilibili/partion/33',
|
|
9
|
-
parameters: { tid: '分区 id',
|
|
9
|
+
parameters: { tid: '分区 id', embed: '默认为开启内嵌视频, 任意值为关闭' },
|
|
10
10
|
features: {
|
|
11
11
|
requireConfig: false,
|
|
12
12
|
requirePuppeteer: false,
|
|
@@ -135,7 +135,7 @@ export const route: Route = {
|
|
|
135
135
|
|
|
136
136
|
async function handler(ctx) {
|
|
137
137
|
const tid = ctx.req.param('tid');
|
|
138
|
-
const
|
|
138
|
+
const embed = !ctx.req.param('embed');
|
|
139
139
|
|
|
140
140
|
const response = await got({
|
|
141
141
|
method: 'get',
|
|
@@ -159,7 +159,7 @@ async function handler(ctx) {
|
|
|
159
159
|
list &&
|
|
160
160
|
list.map((item) => ({
|
|
161
161
|
title: item.title,
|
|
162
|
-
description:
|
|
162
|
+
description: utils.renderUGCDescription(embed, item.pic, item.desc, item.aid, undefined, item.bvid),
|
|
163
163
|
pubDate: new Date(item.pubdate * 1000).toUTCString(),
|
|
164
164
|
link: item.pubdate > utils.bvidTime && item.bvid ? `https://www.bilibili.com/video/${item.bvid}` : `https://www.bilibili.com/video/av${item.aid}`,
|
|
165
165
|
author: item.owner.name,
|
|
@@ -3,10 +3,12 @@ import got from '@/utils/got';
|
|
|
3
3
|
import utils from './utils';
|
|
4
4
|
|
|
5
5
|
export const route: Route = {
|
|
6
|
-
path: '/popular/all',
|
|
6
|
+
path: '/popular/all/:embed?',
|
|
7
7
|
categories: ['social-media'],
|
|
8
8
|
example: '/bilibili/popular/all',
|
|
9
|
-
parameters: {
|
|
9
|
+
parameters: {
|
|
10
|
+
embed: '默认为开启内嵌视频, 任意值为关闭',
|
|
11
|
+
},
|
|
10
12
|
features: {
|
|
11
13
|
requireConfig: false,
|
|
12
14
|
requirePuppeteer: false,
|
|
@@ -21,7 +23,7 @@ export const route: Route = {
|
|
|
21
23
|
};
|
|
22
24
|
|
|
23
25
|
async function handler(ctx) {
|
|
24
|
-
const
|
|
26
|
+
const embed = !ctx.req.param('embed');
|
|
25
27
|
const response = await got({
|
|
26
28
|
method: 'get',
|
|
27
29
|
url: `https://api.bilibili.com/x/web-interface/popular`,
|
|
@@ -39,7 +41,7 @@ async function handler(ctx) {
|
|
|
39
41
|
list &&
|
|
40
42
|
list.map((item) => ({
|
|
41
43
|
title: item.title,
|
|
42
|
-
description:
|
|
44
|
+
description: utils.renderUGCDescription(embed, item.pic, item.desc, item.aid, undefined, item.bvid),
|
|
43
45
|
pubDate: new Date(item.pubdate * 1000).toUTCString(),
|
|
44
46
|
link: item.pubdate > utils.bvidTime && item.bvid ? `https://www.bilibili.com/video/${item.bvid}` : `https://www.bilibili.com/video/av${item.aid}`,
|
|
45
47
|
author: item.owner.name,
|
|
@@ -3,7 +3,7 @@ import got from '@/utils/got';
|
|
|
3
3
|
import utils from './utils';
|
|
4
4
|
|
|
5
5
|
export const route: Route = {
|
|
6
|
-
path: '/ranking/:rid?/:day?/:arc_type?/:
|
|
6
|
+
path: '/ranking/:rid?/:day?/:arc_type?/:embed?',
|
|
7
7
|
name: '排行榜',
|
|
8
8
|
maintainers: ['DIYgod'],
|
|
9
9
|
categories: ['social-media', 'popular'],
|
|
@@ -104,9 +104,7 @@ export const route: Route = {
|
|
|
104
104
|
},
|
|
105
105
|
],
|
|
106
106
|
},
|
|
107
|
-
|
|
108
|
-
description: '默认为开启内嵌视频, 任意值为关闭',
|
|
109
|
-
},
|
|
107
|
+
embed: '默认为开启内嵌视频, 任意值为关闭',
|
|
110
108
|
},
|
|
111
109
|
handler,
|
|
112
110
|
};
|
|
@@ -115,7 +113,7 @@ async function handler(ctx) {
|
|
|
115
113
|
const rid = ctx.req.param('rid') || '0';
|
|
116
114
|
const day = ctx.req.param('day') || '3';
|
|
117
115
|
const arc_type = ctx.req.param('arc_type') || '1';
|
|
118
|
-
const
|
|
116
|
+
const embed = !ctx.req.param('embed');
|
|
119
117
|
const arc_type1 = arc_type === '0' ? '全部投稿' : '近期投稿';
|
|
120
118
|
const rid_1 = ['0', '1', '168', '3', '129', '4', '36', '188', '160', '119', '155', '5', '181'];
|
|
121
119
|
const rid_2 = ['全站', '动画', '国创相关', '音乐', '舞蹈', '游戏', '科技', '数码', '生活', '鬼畜', '时尚', '娱乐', '影视'];
|
|
@@ -144,7 +142,7 @@ async function handler(ctx) {
|
|
|
144
142
|
link: `https://www.bilibili.com/ranking/all/${rid}/0/${day}`,
|
|
145
143
|
item: list.map((item) => ({
|
|
146
144
|
title: item.title,
|
|
147
|
-
description:
|
|
145
|
+
description: utils.renderUGCDescription(embed, item.pic, item.description || item.title, item.aid, undefined, item.bvid),
|
|
148
146
|
pubDate: item.create && new Date(item.create).toUTCString(),
|
|
149
147
|
author: item.author,
|
|
150
148
|
link: !item.create || (new Date(item.create) / 1000 > utils.bvidTime && item.bvid) ? `https://www.bilibili.com/video/${item.bvid}` : `https://www.bilibili.com/video/av${item.aid}`,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{{ if embed }}
|
|
2
|
+
{{ if ugc }}
|
|
3
|
+
<iframe width="640" height="360" src="https://www.bilibili.com/blackboard/html5mobileplayer.html?aid={{ aid }}&cid={{ cid }}&bvid={{ bvid }}" frameborder="0" allowfullscreen></iframe>
|
|
4
|
+
{{ /if }}
|
|
5
|
+
{{ if ogv }}
|
|
6
|
+
<iframe width="640" height="360" src="https://www.bilibili.com/blackboard/html5mobileplayer.html?seasonId={{ seasonId }}&episodeId={{ episodeId }}" frameborder="0" allowfullscreen></iframe>
|
|
7
|
+
{{ /if }}
|
|
8
|
+
<br>
|
|
9
|
+
{{ /if }}
|
|
10
|
+
<img src="{{ img }}">
|
|
11
|
+
<br>
|
|
12
|
+
{{@ description }}
|