rsshub 1.0.0-master.b3eb3f3 → 1.0.0-master.b3f0276
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 +6 -0
- package/lib/router.js +0 -3
- package/lib/routes/aljazeera/index.ts +17 -14
- package/lib/routes/baai/events.ts +10 -21
- package/lib/routes/baai/hub.ts +59 -29
- package/lib/routes/baai/utils.ts +19 -4
- package/lib/routes/bnu/mba.ts +202 -0
- package/lib/routes/byau/namespace.ts +6 -0
- package/lib/routes/byau/xinwen/index.ts +72 -0
- package/lib/routes/caixin/weekly.ts +5 -14
- package/lib/routes/chub/characters.ts +64 -0
- package/lib/routes/chub/namespace.ts +6 -0
- package/lib/routes/colamanga/manga.ts +88 -0
- package/lib/routes/colamanga/namespace.ts +9 -0
- package/lib/routes/copernicium/index.ts +66 -0
- package/lib/routes/copernicium/namespace.ts +6 -0
- package/lib/routes/cpcaauto/index.ts +255 -0
- package/lib/routes/cpcaauto/namespace.ts +8 -0
- package/lib/routes/crossbell/feeds/following.ts +20 -18
- package/lib/routes/crossbell/notes/utils.ts +15 -17
- package/lib/routes/daily/discussed.ts +0 -11
- package/lib/routes/daily/index.ts +2 -2
- package/lib/routes/daily/namespace.ts +1 -0
- package/lib/routes/daily/templates/posts.art +7 -0
- package/lib/routes/daily/upvoted.ts +5 -16
- package/lib/routes/daily/user.ts +227 -0
- package/lib/routes/daily/utils.ts +33 -16
- package/lib/routes/douyin/live.ts +1 -1
- package/lib/routes/douyu/room.ts +58 -18
- package/lib/routes/ecnu/jwc.ts +67 -0
- package/lib/routes/ecnu/namespace.ts +1 -1
- package/lib/routes/fanbox/index.ts +62 -0
- package/lib/routes/fanbox/namespace.ts +6 -0
- package/lib/routes/fanbox/templates/fanbox-post.art +7 -0
- package/lib/routes/fanbox/types.ts +239 -0
- package/lib/routes/fanbox/utils.ts +188 -0
- package/lib/routes/gov/ah/kjt.ts +229 -0
- package/lib/routes/gov/ah/namespace.ts +8 -0
- package/lib/routes/gov/{namespace.ts → pbc/namespace.ts} +1 -1
- package/lib/routes/gov/stats/index.ts +25 -22
- package/lib/routes/gov/zj/search.ts +80 -0
- package/lib/routes/gxmzu/ai.ts +1 -1
- package/lib/routes/gxmzu/lib.ts +9 -26
- package/lib/routes/gxmzu/utils/index.ts +31 -13
- package/lib/routes/gxmzu/yjs.ts +1 -1
- package/lib/routes/hellogithub/index.ts +2 -2
- package/lib/routes/hellogithub/report.ts +2 -1
- package/lib/routes/hellogithub/volume.ts +39 -24
- package/lib/routes/ieee-security/sp.ts +6 -15
- package/lib/routes/iehou/index.ts +125 -0
- package/lib/routes/iehou/namespace.ts +8 -0
- package/lib/routes/jou/utils/index.ts +35 -25
- package/lib/routes/kpmg/insights.ts +143 -0
- package/lib/routes/kpmg/namespace.ts +10 -0
- package/lib/routes/kpmg/templates/description.art +11 -0
- package/lib/routes/lianxh/index.ts +116 -0
- package/lib/routes/lianxh/namespace.ts +7 -0
- package/lib/routes/lofter/tag.ts +3 -3
- package/lib/routes/lofter/user.ts +3 -3
- package/lib/routes/mckinsey/cn/index.ts +4 -7
- package/lib/routes/ncu/jwc.ts +13 -2
- package/lib/routes/njxzc/utils/index.ts +31 -13
- package/lib/routes/olevod/namespace.ts +6 -0
- package/lib/routes/olevod/vod.ts +49 -0
- package/lib/routes/olevod/vodlist.ts +48 -0
- package/lib/routes/ollama/models.ts +39 -0
- package/lib/routes/ollama/namespace.ts +6 -0
- package/lib/routes/sigsac/ccs.ts +16 -22
- package/lib/routes/sjtu/yzb/zkxx.ts +2 -2
- package/lib/routes/sohu/mp.ts +183 -63
- package/lib/routes/stbu/jsjxy.ts +3 -3
- package/lib/routes/stbu/xyxw.ts +14 -3
- package/lib/routes/steam/appcommunityfeed.ts +92 -0
- package/lib/routes/steam/templates/appcommunityfeed-description.art +4 -0
- package/lib/routes/telegram/channel.ts +12 -0
- package/lib/routes/tencent/news/author.ts +13 -11
- package/lib/routes/ttv/index.ts +78 -0
- package/lib/routes/ttv/namespace.ts +6 -0
- package/lib/routes/twitter/api/web-api/constants.ts +30 -0
- package/lib/routes/twitter/api/web-api/utils.ts +1 -1
- package/lib/routes/twitter/tweet.ts +10 -1
- package/lib/routes/u3c3/index.ts +1 -1
- package/lib/routes/u3c3/namespace.ts +1 -1
- package/lib/routes/u9a9/index.ts +2 -2
- package/lib/routes/u9a9/namespace.ts +1 -1
- package/lib/routes/usenix/usenix.ts +24 -31
- package/lib/routes/wechat/tgchannel.ts +8 -1
- package/lib/routes/weibo/keyword.ts +12 -10
- package/lib/routes/yenpress/namespace.ts +7 -0
- package/lib/routes/yenpress/series.ts +115 -0
- package/lib/routes/yenpress/templates/series.art +25 -0
- package/lib/routes/zsxq/group.ts +63 -0
- package/lib/routes/zsxq/namespace.ts +6 -0
- package/lib/routes/zsxq/types.ts +149 -0
- package/lib/routes/zsxq/user.ts +58 -0
- package/lib/routes/zsxq/utils.ts +70 -0
- package/lib/setup.test.ts +66 -2
- package/lib/utils/got.test.ts +2 -1
- package/lib/utils/got.ts +2 -5
- package/lib/utils/request-rewriter/get.ts +8 -1
- package/lib/utils/wechat-mp.test.ts +75 -4
- package/lib/utils/wechat-mp.ts +78 -18
- package/lib/views/error.tsx +1 -23
- package/lib/views/index.tsx +4 -26
- package/lib/views/layout.tsx +50 -0
- package/package.json +28 -30
- package/lib/routes/baai/comments.ts +0 -59
- package/lib/routes/gov/anhui/kjt.ts +0 -65
- package/lib/routes-deprecated/fanbox/conv.js +0 -227
- package/lib/routes-deprecated/fanbox/header.js +0 -13
- package/lib/routes-deprecated/fanbox/main.js +0 -45
- package/lib/routes-deprecated/kpmg/insights.js +0 -79
package/lib/config.ts
CHANGED
|
@@ -298,6 +298,9 @@ export type Config = {
|
|
|
298
298
|
zodgame: {
|
|
299
299
|
cookie?: string;
|
|
300
300
|
};
|
|
301
|
+
zsxq: {
|
|
302
|
+
accessToken?: string;
|
|
303
|
+
};
|
|
301
304
|
};
|
|
302
305
|
|
|
303
306
|
const value: Config | Record<string, any> = {};
|
|
@@ -651,6 +654,9 @@ const calculateValue = () => {
|
|
|
651
654
|
zodgame: {
|
|
652
655
|
cookie: envs.ZODGAME_COOKIE,
|
|
653
656
|
},
|
|
657
|
+
zsxq: {
|
|
658
|
+
accessToken: envs.ZSXQ_ACCESS_TOKEN,
|
|
659
|
+
},
|
|
654
660
|
};
|
|
655
661
|
|
|
656
662
|
for (const name in _value) {
|
package/lib/router.js
CHANGED
|
@@ -25,9 +25,6 @@ router.get('/benedictevans', lazyloadRouteHandler('./routes/benedictevans/recent
|
|
|
25
25
|
// router.get('/jianshu/collection/:id', lazyloadRouteHandler('./routes/jianshu/collection'));
|
|
26
26
|
// router.get('/jianshu/user/:id', lazyloadRouteHandler('./routes/jianshu/user'));
|
|
27
27
|
|
|
28
|
-
// pixiv-fanbox
|
|
29
|
-
router.get('/fanbox/:user?', lazyloadRouteHandler('./routes/fanbox/main'));
|
|
30
|
-
|
|
31
28
|
// Disqus
|
|
32
29
|
router.get('/disqus/posts/:forum', lazyloadRouteHandler('./routes/disqus/posts'));
|
|
33
30
|
|
|
@@ -4,11 +4,10 @@ const __dirname = getCurrentPath(import.meta.url);
|
|
|
4
4
|
|
|
5
5
|
import { getSubPath } from '@/utils/common-utils';
|
|
6
6
|
import cache from '@/utils/cache';
|
|
7
|
-
import got from '@/utils/got';
|
|
8
7
|
import { load } from 'cheerio';
|
|
9
|
-
import { parseDate } from '@/utils/parse-date';
|
|
10
8
|
import { art } from '@/utils/render';
|
|
11
9
|
import path from 'node:path';
|
|
10
|
+
import { ofetch } from 'ofetch';
|
|
12
11
|
|
|
13
12
|
const languages = {
|
|
14
13
|
arabic: {
|
|
@@ -45,12 +44,8 @@ async function handler(ctx) {
|
|
|
45
44
|
const rootUrl = languages[language].rootUrl;
|
|
46
45
|
const currentUrl = `${rootUrl}/${isRSS ? languages[language].rssUrl : params.join('/')}`;
|
|
47
46
|
|
|
48
|
-
const response = await
|
|
49
|
-
|
|
50
|
-
url: currentUrl,
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
const $ = load(response.data);
|
|
47
|
+
const response = await ofetch(currentUrl);
|
|
48
|
+
const $ = load(response);
|
|
54
49
|
|
|
55
50
|
let items = isRSS
|
|
56
51
|
? response.data.match(new RegExp('<link>' + rootUrl + '/(.*?)</link>', 'g')).map((item) => ({
|
|
@@ -69,19 +64,27 @@ async function handler(ctx) {
|
|
|
69
64
|
items = await Promise.all(
|
|
70
65
|
items.slice(0, ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : 50).map((item) =>
|
|
71
66
|
cache.tryGet(item.link, async () => {
|
|
72
|
-
const detailResponse = await
|
|
73
|
-
method: 'get',
|
|
74
|
-
url: item.link,
|
|
75
|
-
});
|
|
67
|
+
const detailResponse = await ofetch(item.link);
|
|
76
68
|
|
|
77
|
-
const content = load(detailResponse
|
|
69
|
+
const content = load(detailResponse);
|
|
78
70
|
|
|
79
71
|
content('.more-on').parent().remove();
|
|
80
72
|
content('.responsive-image img').removeAttr('srcset');
|
|
73
|
+
let pubDate;
|
|
74
|
+
|
|
75
|
+
const datePublished = detailResponse.match(/"datePublished": ?"(.*?)",/);
|
|
76
|
+
if (datePublished && datePublished.length > 1) {
|
|
77
|
+
pubDate = detailResponse.match(/"datePublished": ?"(.*?)",/)[1];
|
|
78
|
+
} else {
|
|
79
|
+
// uploadDate replaces datePublished for video articles
|
|
80
|
+
const uploadDate = detailResponse.match(/"uploadDate": ?"(.*?)",/)[1];
|
|
81
|
+
|
|
82
|
+
pubDate = uploadDate && uploadDate.length > 1 ? uploadDate : content('div.date-simple > span:nth-child(2)').text();
|
|
83
|
+
}
|
|
81
84
|
|
|
82
85
|
item.title = content('h1').first().text();
|
|
83
86
|
item.author = content('.author').text();
|
|
84
|
-
item.pubDate =
|
|
87
|
+
item.pubDate = pubDate;
|
|
85
88
|
item.description = art(path.join(__dirname, 'templates/description.art'), {
|
|
86
89
|
image: content('.article-featured-image').html(),
|
|
87
90
|
description: content('.wysiwyg').html(),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Route } from '@/types';
|
|
2
2
|
import cache from '@/utils/cache';
|
|
3
|
-
import
|
|
3
|
+
import ofetch from '@/utils/ofetch';
|
|
4
4
|
|
|
5
5
|
import { baseUrl, apiHost, parseEventDetail, parseItem } from './utils';
|
|
6
6
|
|
|
@@ -8,15 +8,6 @@ export const route: Route = {
|
|
|
8
8
|
path: '/hub/events',
|
|
9
9
|
categories: ['programming'],
|
|
10
10
|
example: '/baai/hub/events',
|
|
11
|
-
parameters: {},
|
|
12
|
-
features: {
|
|
13
|
-
requireConfig: false,
|
|
14
|
-
requirePuppeteer: false,
|
|
15
|
-
antiCrawler: false,
|
|
16
|
-
supportBT: false,
|
|
17
|
-
supportPodcast: false,
|
|
18
|
-
supportScihub: false,
|
|
19
|
-
},
|
|
20
11
|
radar: [
|
|
21
12
|
{
|
|
22
13
|
source: ['hub.baai.ac.cn/events', 'hub.baai.ac.cn/'],
|
|
@@ -28,18 +19,16 @@ export const route: Route = {
|
|
|
28
19
|
url: 'hub.baai.ac.cn/events',
|
|
29
20
|
};
|
|
30
21
|
|
|
31
|
-
async function handler(
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
).map((url) => got.post(url))
|
|
40
|
-
);
|
|
22
|
+
async function handler() {
|
|
23
|
+
const response = await ofetch(`${apiHost}/api/v1/events`, {
|
|
24
|
+
method: 'POST',
|
|
25
|
+
body: {
|
|
26
|
+
page: 1,
|
|
27
|
+
tag_id: '',
|
|
28
|
+
},
|
|
29
|
+
});
|
|
41
30
|
|
|
42
|
-
const list =
|
|
31
|
+
const list = response.data.map((item) => parseItem(item));
|
|
43
32
|
|
|
44
33
|
const items = await Promise.all(
|
|
45
34
|
list.map((item) =>
|
package/lib/routes/baai/hub.ts
CHANGED
|
@@ -1,47 +1,77 @@
|
|
|
1
1
|
import { Route } from '@/types';
|
|
2
2
|
import cache from '@/utils/cache';
|
|
3
|
-
import
|
|
3
|
+
import ofetch from '@/utils/ofetch';
|
|
4
4
|
import { load } from 'cheerio';
|
|
5
5
|
|
|
6
|
-
import { baseUrl, apiHost, parseEventDetail, parseItem } from './utils';
|
|
6
|
+
import { baseUrl, apiHost, getTagsData, parseEventDetail, parseItem } from './utils';
|
|
7
|
+
import InvalidParameterError from '@/errors/types/invalid-parameter';
|
|
7
8
|
|
|
8
9
|
export const route: Route = {
|
|
9
|
-
path: ['/hub/:tagId
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
path: ['/hub/:tagId?/:sort?/:range?'],
|
|
11
|
+
categories: ['programming'],
|
|
12
|
+
example: '/baai/hub',
|
|
13
|
+
parameters: {
|
|
14
|
+
tagId: '社群 ID,可在 [社群页](https://hub.baai.ac.cn/taglist) 或 URL 中找到',
|
|
15
|
+
sort: '排序,见下表,默认为 `new`',
|
|
16
|
+
range: '时间跨度,仅在排序 `readCnt` 时有效',
|
|
17
|
+
},
|
|
18
|
+
description: `排序
|
|
19
|
+
|
|
20
|
+
| 最新 | 最热 |
|
|
21
|
+
| ---- | ------- |
|
|
22
|
+
| new | readCnt |
|
|
23
|
+
|
|
24
|
+
时间跨度
|
|
25
|
+
|
|
26
|
+
| 3 天 | 本周 | 本月 |
|
|
27
|
+
| ---- | ---- | ---- |
|
|
28
|
+
| 3 | 7 | 30 |`,
|
|
29
|
+
radar: [
|
|
30
|
+
{
|
|
31
|
+
source: ['baai.ac.cn/'],
|
|
32
|
+
target: (_params, url) => {
|
|
33
|
+
const searchParams = new URL(url).searchParams;
|
|
34
|
+
const tagId = searchParams.get('tag_id');
|
|
35
|
+
const sort = searchParams.get('sort');
|
|
36
|
+
const range = searchParams.get('time_range');
|
|
37
|
+
return `/baai/hub${tagId ? `/${tagId}` : ''}${sort ? `/${sort}` : ''}${range ? `/${range}` : ''}`;
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
name: '智源社区',
|
|
42
|
+
maintainers: ['TonyRL'],
|
|
12
43
|
handler,
|
|
13
44
|
};
|
|
14
45
|
|
|
15
46
|
async function handler(ctx) {
|
|
16
|
-
const { tagId, sort = 'new', range } = ctx.req.param();
|
|
47
|
+
const { tagId = '', sort = 'new', range } = ctx.req.param();
|
|
17
48
|
|
|
18
49
|
let title, description, brief, iconUrl;
|
|
19
50
|
if (tagId) {
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
51
|
+
const tagsData = await getTagsData();
|
|
52
|
+
|
|
53
|
+
const tag = (tagsData as Record<string, string>[]).find((tag) => tag.id === tagId);
|
|
54
|
+
if (tag) {
|
|
55
|
+
title = tag.title;
|
|
56
|
+
description = tag.description;
|
|
57
|
+
brief = tag.brief;
|
|
58
|
+
iconUrl = tag.iconUrl;
|
|
59
|
+
} else {
|
|
60
|
+
throw new InvalidParameterError('Tag not found');
|
|
61
|
+
}
|
|
29
62
|
}
|
|
30
63
|
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
);
|
|
64
|
+
const response = await ofetch(`${apiHost}/api/v1/story/list`, {
|
|
65
|
+
method: 'POST',
|
|
66
|
+
query: {
|
|
67
|
+
page: 1,
|
|
68
|
+
sort,
|
|
69
|
+
tag_id: tagId,
|
|
70
|
+
time_range: range,
|
|
71
|
+
},
|
|
72
|
+
});
|
|
40
73
|
|
|
41
|
-
const list =
|
|
42
|
-
.filter((response) => response.data.data)
|
|
43
|
-
.flatMap((response) => response.data.data)
|
|
44
|
-
.map((item) => parseItem(item));
|
|
74
|
+
const list = response.data.map((item) => parseItem(item));
|
|
45
75
|
|
|
46
76
|
const items = await Promise.all(
|
|
47
77
|
list.map((item) =>
|
|
@@ -49,7 +79,7 @@ async function handler(ctx) {
|
|
|
49
79
|
if (item.eventId) {
|
|
50
80
|
item.description = await parseEventDetail(item);
|
|
51
81
|
} else {
|
|
52
|
-
const
|
|
82
|
+
const response = await ofetch(item.link);
|
|
53
83
|
const $ = load(response);
|
|
54
84
|
item.description = item.is_event ? $('div.box2').html() : $('.post-content').html();
|
|
55
85
|
}
|
package/lib/routes/baai/utils.ts
CHANGED
|
@@ -1,11 +1,25 @@
|
|
|
1
|
-
import
|
|
1
|
+
import ofetch from '@/utils/ofetch';
|
|
2
|
+
import { destr } from 'destr';
|
|
2
3
|
import { parseDate } from '@/utils/parse-date';
|
|
3
4
|
import timezone from '@/utils/timezone';
|
|
5
|
+
import cache from '@/utils/cache';
|
|
4
6
|
|
|
5
7
|
const baseUrl = 'https://hub.baai.ac.cn';
|
|
6
8
|
const eventUrl = 'https://event.baai.ac.cn';
|
|
7
9
|
const apiHost = 'https://hub-api.baai.ac.cn';
|
|
8
10
|
|
|
11
|
+
const getTagsData = () =>
|
|
12
|
+
cache.tryGet('baai:tags', async () => {
|
|
13
|
+
const { data } = await ofetch(`${apiHost}/api/v1/tags`);
|
|
14
|
+
return data.map((item) => ({
|
|
15
|
+
id: item.id,
|
|
16
|
+
title: item.title,
|
|
17
|
+
description: item.description,
|
|
18
|
+
brief: item.brief,
|
|
19
|
+
iconUrl: item.icon_url,
|
|
20
|
+
}));
|
|
21
|
+
});
|
|
22
|
+
|
|
9
23
|
const parseItem = (item) => ({
|
|
10
24
|
link: item.is_event ? `${eventUrl}/activities/${item.event_info.id}` : `${baseUrl}/view/${item.story_id}`,
|
|
11
25
|
title: item.is_event ? item.event_info.name : item.story_info.title,
|
|
@@ -16,12 +30,13 @@ const parseItem = (item) => ({
|
|
|
16
30
|
});
|
|
17
31
|
|
|
18
32
|
const parseEventDetail = async (item) => {
|
|
19
|
-
const
|
|
20
|
-
|
|
33
|
+
const data = await ofetch(`${eventUrl}/api/api/Activity/IntroductionTypes`, {
|
|
34
|
+
query: {
|
|
21
35
|
activityId: item.eventId,
|
|
22
36
|
},
|
|
37
|
+
parseResponse: (txt) => destr(txt),
|
|
23
38
|
});
|
|
24
39
|
return data.data.ac_desc + data.data.ac_desc_two;
|
|
25
40
|
};
|
|
26
41
|
|
|
27
|
-
export { baseUrl, eventUrl, apiHost, parseItem, parseEventDetail };
|
|
42
|
+
export { baseUrl, eventUrl, apiHost, getTagsData, parseItem, parseEventDetail };
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { Route } from '@/types';
|
|
2
|
+
|
|
3
|
+
import cache from '@/utils/cache';
|
|
4
|
+
import got from '@/utils/got';
|
|
5
|
+
import { load } from 'cheerio';
|
|
6
|
+
import { parseDate } from '@/utils/parse-date';
|
|
7
|
+
|
|
8
|
+
export const handler = async (ctx) => {
|
|
9
|
+
const { category = 'xwdt' } = ctx.req.param();
|
|
10
|
+
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 20;
|
|
11
|
+
|
|
12
|
+
const rootUrl = 'https://mba.bnu.edu.cn';
|
|
13
|
+
const currentUrl = new URL(`${category.replace(/\/$/, '')}/`, rootUrl).href;
|
|
14
|
+
|
|
15
|
+
const { data: response } = await got(currentUrl);
|
|
16
|
+
|
|
17
|
+
const $ = load(response);
|
|
18
|
+
|
|
19
|
+
const language = $('html').prop('lang');
|
|
20
|
+
|
|
21
|
+
let items = $('ul.concrcc li')
|
|
22
|
+
.slice(0, limit)
|
|
23
|
+
.toArray()
|
|
24
|
+
.map((item) => {
|
|
25
|
+
item = $(item);
|
|
26
|
+
|
|
27
|
+
const a = item.find('a.listlj');
|
|
28
|
+
const title = a.text();
|
|
29
|
+
|
|
30
|
+
return {
|
|
31
|
+
title,
|
|
32
|
+
pubDate: parseDate(item.find('div.crq').text()),
|
|
33
|
+
link: new URL(a.prop('href'), currentUrl).href,
|
|
34
|
+
language,
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
items = await Promise.all(
|
|
39
|
+
items.map((item) =>
|
|
40
|
+
cache.tryGet(item.link, async () => {
|
|
41
|
+
const { data: detailResponse } = await got(item.link);
|
|
42
|
+
|
|
43
|
+
const $$ = load(detailResponse);
|
|
44
|
+
|
|
45
|
+
const title = $$('div.connewst').text();
|
|
46
|
+
const description = $$('div.concrczw').html();
|
|
47
|
+
const image = $$('div.concrczw img').first().prop('src');
|
|
48
|
+
|
|
49
|
+
item.title = title;
|
|
50
|
+
item.description = description;
|
|
51
|
+
item.pubDate = parseDate($$('div.connewstis-time').text().split(/:/).pop());
|
|
52
|
+
item.content = {
|
|
53
|
+
html: description,
|
|
54
|
+
text: $$('div.concrczw').text(),
|
|
55
|
+
};
|
|
56
|
+
item.image = image;
|
|
57
|
+
item.banner = image;
|
|
58
|
+
item.language = language;
|
|
59
|
+
|
|
60
|
+
return item;
|
|
61
|
+
})
|
|
62
|
+
)
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
const author = $('title').text();
|
|
66
|
+
const image = new URL('images/logo5.png', rootUrl).href;
|
|
67
|
+
|
|
68
|
+
return {
|
|
69
|
+
title: `${author} - ${$('div.concrchbt').text()}`,
|
|
70
|
+
link: currentUrl,
|
|
71
|
+
item: items,
|
|
72
|
+
allowEmpty: true,
|
|
73
|
+
image,
|
|
74
|
+
author,
|
|
75
|
+
language,
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export const route: Route = {
|
|
80
|
+
path: '/mba/:category{.+}?',
|
|
81
|
+
name: '经济与工商管理学院MBA',
|
|
82
|
+
url: 'mba.bnu.edu.cn',
|
|
83
|
+
maintainers: ['nczitzk'],
|
|
84
|
+
handler,
|
|
85
|
+
example: '/bnu/mba/xwdt',
|
|
86
|
+
parameters: { category: '分类,默认为 xwdt,即新闻聚焦' },
|
|
87
|
+
description: `:::tip
|
|
88
|
+
若订阅 [新闻聚焦](https://mba.bnu.edu.cn/xwdt/index.html),网址为 \`https://mba.bnu.edu.cn/xwdt/index.html\`。截取 \`https://mba.bnu.edu.cn/\` 到末尾 \`/index.html\` 的部分 \`xwdt\` 作为参数填入,此时路由为 [\`/bnu/mba/xwdt\`](https://rsshub.app/bnu/mba/xwdt)。
|
|
89
|
+
:::
|
|
90
|
+
|
|
91
|
+
#### [主页](https://mba.bnu.edu.cn)
|
|
92
|
+
|
|
93
|
+
| [新闻聚焦](https://mba.bnu.edu.cn/xwdt/index.html) | [通知公告](https://mba.bnu.edu.cn/tzgg/index.html) | [MBA 系列讲座](https://mba.bnu.edu.cn/mbaxljz/index.html) |
|
|
94
|
+
| -------------------------------------------------- | -------------------------------------------------- | --------------------------------------------------------- |
|
|
95
|
+
| [xwdt](https://rsshub.app/bnu/mba/xwdt) | [tzgg](https://rsshub.app/bnu/mba/tzgg) | [mbaxljz](https://rsshub.app/bnu/mba/mbaxljz) |
|
|
96
|
+
|
|
97
|
+
#### [招生动态](https://mba.bnu.edu.cn/zsdt/zsjz/index.html)
|
|
98
|
+
|
|
99
|
+
| [下载专区](https://mba.bnu.edu.cn/zsdt/cjwt/index.html) |
|
|
100
|
+
| ------------------------------------------------------- |
|
|
101
|
+
| [zsdt/cjwt](https://rsshub.app/bnu/mba/zsdt/cjwt) |
|
|
102
|
+
|
|
103
|
+
#### [国际视野](https://mba.bnu.edu.cn/gjhz/hwjd/index.html)
|
|
104
|
+
|
|
105
|
+
| [海外基地](https://mba.bnu.edu.cn/gjhz/hwjd/index.html) | [学位合作](https://mba.bnu.edu.cn/gjhz/xwhz/index.html) | [长期交换](https://mba.bnu.edu.cn/gjhz/zqjh/index.html) | [短期项目](https://mba.bnu.edu.cn/gjhz/dqxm/index.html) |
|
|
106
|
+
| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- |
|
|
107
|
+
| [gjhz/hwjd](https://rsshub.app/bnu/mba/gjhz/hwjd) | [gjhz/xwhz](https://rsshub.app/bnu/mba/gjhz/xwhz) | [gjhz/zqjh](https://rsshub.app/bnu/mba/gjhz/zqjh) | [gjhz/dqxm](https://rsshub.app/bnu/mba/gjhz/dqxm) |
|
|
108
|
+
|
|
109
|
+
#### [校园生活](https://mba.bnu.edu.cn/xysh/xszz/index.html)
|
|
110
|
+
|
|
111
|
+
| [学生组织](https://mba.bnu.edu.cn/xysh/xszz/index.html) |
|
|
112
|
+
| ------------------------------------------------------- |
|
|
113
|
+
| [xysh/xszz](https://rsshub.app/bnu/mba/xysh/xszz) |
|
|
114
|
+
|
|
115
|
+
#### [职业发展](https://mba.bnu.edu.cn/zyfz/xwds/index.html)
|
|
116
|
+
|
|
117
|
+
| [校外导师](https://mba.bnu.edu.cn/zyfz/xwds/index.html) | [企业实践](https://mba.bnu.edu.cn/zyfz/zycp/index.html) | [就业创业](https://mba.bnu.edu.cn/zyfz/jycy/index.html) |
|
|
118
|
+
| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- |
|
|
119
|
+
| [zyfz/xwds](https://rsshub.app/bnu/mba/zyfz/xwds) | [zyfz/zycp](https://rsshub.app/bnu/mba/zyfz/zycp) | [zyfz/jycy](https://rsshub.app/bnu/mba/zyfz/jycy) |
|
|
120
|
+
`,
|
|
121
|
+
categories: ['university'],
|
|
122
|
+
|
|
123
|
+
features: {
|
|
124
|
+
requireConfig: false,
|
|
125
|
+
requirePuppeteer: false,
|
|
126
|
+
antiCrawler: false,
|
|
127
|
+
supportRadar: true,
|
|
128
|
+
supportBT: false,
|
|
129
|
+
supportPodcast: false,
|
|
130
|
+
supportScihub: false,
|
|
131
|
+
},
|
|
132
|
+
radar: [
|
|
133
|
+
{
|
|
134
|
+
source: ['mba.bnu.edu.cn/:category?'],
|
|
135
|
+
target: (params) => {
|
|
136
|
+
const category = params.category;
|
|
137
|
+
|
|
138
|
+
return category ? `/${category.replace(/\/index\.html$/, '')}` : '';
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
title: '新闻聚焦',
|
|
143
|
+
source: ['mba.bnu.edu.cn/xwdt/index.html'],
|
|
144
|
+
target: '/mba/xwdt',
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
title: '通知公告',
|
|
148
|
+
source: ['mba.bnu.edu.cn/tzgg/index.html'],
|
|
149
|
+
target: '/mba/tzgg',
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
title: 'MBA系列讲座',
|
|
153
|
+
source: ['mba.bnu.edu.cn/mbaxljz/index.html'],
|
|
154
|
+
target: '/mba/mbaxljz',
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
title: '招生动态 - 下载专区',
|
|
158
|
+
source: ['mba.bnu.edu.cn/zsdt/cjwt/index.html'],
|
|
159
|
+
target: '/mba/zsdt/cjwt',
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
title: '国际视野 - 海外基地',
|
|
163
|
+
source: ['mba.bnu.edu.cn/gjhz/hwjd/index.html'],
|
|
164
|
+
target: '/mba/gjhz/hwjd',
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
title: '国际视野 - 学位合作',
|
|
168
|
+
source: ['mba.bnu.edu.cn/gjhz/xwhz/index.html'],
|
|
169
|
+
target: '/mba/gjhz/xwhz',
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
title: '国际视野 - 长期交换',
|
|
173
|
+
source: ['mba.bnu.edu.cn/gjhz/zqjh/index.html'],
|
|
174
|
+
target: '/mba/gjhz/zqjh',
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
title: '国际视野 - 短期项目',
|
|
178
|
+
source: ['mba.bnu.edu.cn/gjhz/dqxm/index.html'],
|
|
179
|
+
target: '/mba/gjhz/dqxm',
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
title: '校园生活 - 学生组织',
|
|
183
|
+
source: ['mba.bnu.edu.cn/xysh/xszz/index.html'],
|
|
184
|
+
target: '/mba/xysh/xszz',
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
title: '职业发展 - 校外导师',
|
|
188
|
+
source: ['mba.bnu.edu.cn/zyfz/xwds/index.html'],
|
|
189
|
+
target: '/mba/zyfz/xwds',
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
title: '职业发展 - 企业实践',
|
|
193
|
+
source: ['mba.bnu.edu.cn/zyfz/zycp/index.html'],
|
|
194
|
+
target: '/mba/zyfz/zycp',
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
title: '职业发展 - 就业创业',
|
|
198
|
+
source: ['mba.bnu.edu.cn/zyfz/jycy/index.html'],
|
|
199
|
+
target: '/mba/zyfz/jycy',
|
|
200
|
+
},
|
|
201
|
+
],
|
|
202
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Route } from '@/types';
|
|
2
|
+
import cache from '@/utils/cache';
|
|
3
|
+
import got from '@/utils/got';
|
|
4
|
+
import { load } from 'cheerio';
|
|
5
|
+
import { parseDate } from '@/utils/parse-date';
|
|
6
|
+
import timezone from '@/utils/timezone';
|
|
7
|
+
|
|
8
|
+
export const route: Route = {
|
|
9
|
+
path: '/news/:type_id',
|
|
10
|
+
categories: ['university'],
|
|
11
|
+
example: '/byau/news/3674',
|
|
12
|
+
parameters: { type_id: '栏目类型(从菜单栏获取对应 ID)' },
|
|
13
|
+
radar: [
|
|
14
|
+
{
|
|
15
|
+
source: ['xinwen.byau.edu.cn/:type_id/list.htm'],
|
|
16
|
+
target: '/news/:type_id',
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
name: '新闻网',
|
|
20
|
+
maintainers: ['ueiu'],
|
|
21
|
+
handler,
|
|
22
|
+
url: 'xinwen.byau.edu.cn',
|
|
23
|
+
description: `| 学校要闻 | 校园动态 |
|
|
24
|
+
| ---- | ----------- |
|
|
25
|
+
| 3674 | 3676 |`,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
async function handler(ctx) {
|
|
29
|
+
const baseUrl = 'http://xinwen.byau.edu.cn/';
|
|
30
|
+
|
|
31
|
+
const typeID = ctx.req.param('type_id');
|
|
32
|
+
const url = `${baseUrl}${typeID}/list.htm`;
|
|
33
|
+
|
|
34
|
+
const response = await got(url);
|
|
35
|
+
const $ = load(response.data);
|
|
36
|
+
|
|
37
|
+
const list = $('.news')
|
|
38
|
+
.toArray()
|
|
39
|
+
.map((item) => {
|
|
40
|
+
const $$ = load(item);
|
|
41
|
+
|
|
42
|
+
const originalItemUrl = $$('a').attr('href');
|
|
43
|
+
// 因为学校要闻的头两个像是固定了跳转专栏页面的,不能相同处理
|
|
44
|
+
const startsWithHttp = originalItemUrl.startsWith('http');
|
|
45
|
+
const itemUrl = startsWithHttp ? originalItemUrl : new URL(originalItemUrl, baseUrl).href;
|
|
46
|
+
|
|
47
|
+
return {
|
|
48
|
+
title: $$('a').text(),
|
|
49
|
+
link: itemUrl,
|
|
50
|
+
pubDate: timezone(parseDate($$('.news_meta').text()), +8),
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const items = await Promise.all(
|
|
55
|
+
list.map((item) =>
|
|
56
|
+
cache.tryGet(item.link, async () => {
|
|
57
|
+
const response = await got(item.link);
|
|
58
|
+
const $ = load(response.data);
|
|
59
|
+
|
|
60
|
+
item.description = $('.col_news_con').html();
|
|
61
|
+
|
|
62
|
+
return item;
|
|
63
|
+
})
|
|
64
|
+
)
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
return {
|
|
68
|
+
title: $('title').text(),
|
|
69
|
+
link: url,
|
|
70
|
+
item: items,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Route } from '@/types';
|
|
1
|
+
import { DataItem, Route } from '@/types';
|
|
2
2
|
import cache from '@/utils/cache';
|
|
3
3
|
import got from '@/utils/got';
|
|
4
4
|
import { load } from 'cheerio';
|
|
@@ -8,15 +8,6 @@ export const route: Route = {
|
|
|
8
8
|
path: '/weekly',
|
|
9
9
|
categories: ['traditional-media'],
|
|
10
10
|
example: '/caixin/weekly',
|
|
11
|
-
parameters: {},
|
|
12
|
-
features: {
|
|
13
|
-
requireConfig: false,
|
|
14
|
-
requirePuppeteer: false,
|
|
15
|
-
antiCrawler: false,
|
|
16
|
-
supportBT: false,
|
|
17
|
-
supportPodcast: false,
|
|
18
|
-
supportScihub: false,
|
|
19
|
-
},
|
|
20
11
|
radar: [
|
|
21
12
|
{
|
|
22
13
|
source: ['weekly.caixin.com/', 'weekly.caixin.com/*'],
|
|
@@ -38,16 +29,16 @@ async function handler(ctx) {
|
|
|
38
29
|
...$('.mi')
|
|
39
30
|
.toArray()
|
|
40
31
|
.map((item) => ({
|
|
41
|
-
link: $(item).find('a').attr('href'),
|
|
32
|
+
link: $(item).find('a').attr('href')?.replace('http:', 'https:'),
|
|
42
33
|
})),
|
|
43
34
|
...$('.xsjCon a')
|
|
44
35
|
.toArray()
|
|
45
36
|
.map((item) => ({
|
|
46
37
|
link: $(item).attr('href'),
|
|
47
38
|
})),
|
|
48
|
-
].slice(0, ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 10);
|
|
39
|
+
].slice(0, ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 10) as DataItem[];
|
|
49
40
|
|
|
50
|
-
const items = await Promise.all(
|
|
41
|
+
const items = (await Promise.all(
|
|
51
42
|
list.map((item) =>
|
|
52
43
|
cache.tryGet(item.link, async () => {
|
|
53
44
|
const { data } = await got(item.link);
|
|
@@ -73,7 +64,7 @@ async function handler(ctx) {
|
|
|
73
64
|
return item;
|
|
74
65
|
})
|
|
75
66
|
)
|
|
76
|
-
);
|
|
67
|
+
)) as DataItem[];
|
|
77
68
|
|
|
78
69
|
return {
|
|
79
70
|
title: $('head title')
|