rsshub 1.0.0-master.f2c8f0c → 1.0.0-master.f2eee10
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/router.js +4 -3
- package/lib/utils/wechat-mp.js +1 -1
- package/lib/v2/2048/index.js +7 -5
- package/lib/v2/agirls/index.js +14 -42
- package/lib/v2/agirls/topic.js +16 -43
- package/lib/v2/agirls/topic_list.js +14 -14
- package/lib/v2/agirls/utils.js +37 -0
- package/lib/v2/apnews/topics.js +24 -30
- package/lib/v2/baozimh/index.js +9 -14
- package/lib/v2/bilibili/followers.js +12 -1
- package/lib/v2/bilibili/followings.js +16 -1
- package/lib/v2/bilibili/liveSearch.js +18 -10
- package/lib/v2/bilibili/maintainer.js +2 -2
- package/lib/v2/bilibili/router.js +2 -2
- package/lib/v2/blizzard/maintainer.js +3 -0
- package/lib/{routes → v2}/blizzard/news.js +14 -15
- package/lib/v2/blizzard/radar.js +13 -0
- package/lib/v2/blizzard/router.js +3 -0
- package/lib/v2/caixin/latest.js +5 -5
- package/lib/v2/copymanga/comic.js +74 -58
- package/lib/v2/copymanga/templates/comic.art +1 -1
- package/lib/v2/dhu/maintainer.js +1 -0
- package/lib/v2/dhu/news/xsxx.js +42 -0
- package/lib/v2/dhu/radar.js +8 -0
- package/lib/v2/dhu/router.js +1 -0
- package/lib/v2/globallawreview/index.js +55 -0
- package/lib/v2/globallawreview/maintainer.js +3 -0
- package/lib/v2/globallawreview/radar.js +13 -0
- package/lib/v2/globallawreview/router.js +3 -0
- package/lib/v2/gov/cac/index.js +4 -4
- package/lib/v2/gov/maintainer.js +1 -0
- package/lib/v2/gov/nifdc/index.js +2 -17
- package/lib/v2/gov/nmpa/generic.js +5 -27
- package/lib/v2/gov/nrta/dsj.js +59 -0
- package/lib/v2/gov/radar.js +13 -0
- package/lib/v2/gov/router.js +1 -0
- package/lib/v2/huoxian/maintainer.js +3 -0
- package/lib/v2/huoxian/radar.js +11 -0
- package/lib/v2/huoxian/router.js +3 -0
- package/lib/v2/huoxian/zone.js +19 -0
- package/lib/v2/javdb/utils.js +5 -4
- package/lib/v2/jike/radar.js +20 -0
- package/lib/v2/keylol/index.js +82 -0
- package/lib/v2/keylol/maintainer.js +3 -0
- package/lib/v2/keylol/radar.js +18 -0
- package/lib/v2/keylol/router.js +3 -0
- package/lib/v2/line/utils.js +18 -2
- package/lib/v2/macupdate/app.js +43 -0
- package/lib/v2/macupdate/maintainer.js +3 -0
- package/lib/v2/macupdate/radar.js +13 -0
- package/lib/v2/macupdate/router.js +3 -0
- package/lib/v2/radiofrance/templates/article.art +3 -1
- package/lib/v2/sec-in/index.js +19 -0
- package/lib/v2/sec-in/maintainer.js +3 -0
- package/lib/v2/sec-in/radar.js +11 -0
- package/lib/v2/sec-in/router.js +3 -0
- package/lib/v2/sec-wiki/maintainer.js +3 -0
- package/lib/v2/sec-wiki/radar.js +11 -0
- package/lib/v2/sec-wiki/router.js +3 -0
- package/lib/v2/sec-wiki/weekly.js +16 -0
- package/lib/v2/shu/index.js +48 -0
- package/lib/v2/shu/jwb.js +45 -0
- package/lib/v2/shu/maintainer.js +4 -0
- package/lib/v2/shu/radar.js +21 -0
- package/lib/v2/shu/router.js +5 -0
- package/lib/v2/stheadline/std/realtime.js +1 -1
- package/lib/v2/wikinews/index.js +28 -29
- package/lib/v2/wxkol/show.js +5 -34
- package/lib/v2/yangtzeu/dongke.js +60 -0
- package/lib/v2/yangtzeu/maintainer.js +3 -0
- package/lib/v2/yangtzeu/radar.js +18 -0
- package/lib/v2/yangtzeu/router.js +3 -0
- package/lib/v2/zaobao/util.js +38 -31
- package/package.json +3 -3
- package/lib/routes/universities/shu/index.js +0 -75
- package/lib/routes/universities/shu/jwc.js +0 -62
- package/lib/v2/agirls/templates/description.art +0 -1
package/lib/v2/gov/router.js
CHANGED
|
@@ -28,6 +28,7 @@ module.exports = function (router) {
|
|
|
28
28
|
router.get(/\/nmpa\/([\w][\w/]+)?/, require('./nmpa/generic'));
|
|
29
29
|
router.get(/nopss(\/[\w/-]+)?/, require('./nopss'));
|
|
30
30
|
router.get('/nrta/news/:category?', require('./nrta/news'));
|
|
31
|
+
router.get('/nrta/dsj/:category?', require('./nrta/dsj'));
|
|
31
32
|
router.get('/nsfc/news/:type?', require('./nsfc'));
|
|
32
33
|
router.get('/pbc/goutongjiaoliu', require('./pbc/goutongjiaoliu'));
|
|
33
34
|
router.get('/pbc/gzlw', require('./pbc/gzlw'));
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
3
|
+
|
|
4
|
+
module.exports = async (ctx) => {
|
|
5
|
+
const { data } = await got('https://zone.huoxian.cn/api/discussions?sort=-createdAt');
|
|
6
|
+
const items = data.data.map((item) => ({
|
|
7
|
+
title: item.attributes.title,
|
|
8
|
+
link: `https://zone.huoxian.cn/d/${item.attributes.slug}`,
|
|
9
|
+
description: data.included.find((i) => i.id === item.relationships.firstPost.data.id).attributes.contentHtml,
|
|
10
|
+
pubDate: parseDate(item.attributes.createdAt),
|
|
11
|
+
author: data.included.find((i) => i.id === item.relationships.user.data.id).attributes.displayName,
|
|
12
|
+
category: data.included.filter((i) => item.relationships.tags.data.map((t) => t.id).includes(i.id) && i.type === 'tags').map((i) => i.attributes.name),
|
|
13
|
+
}));
|
|
14
|
+
ctx.state.data = {
|
|
15
|
+
title: '火线 Zone-安全攻防社区',
|
|
16
|
+
link: 'https://zone.huoxian.cn/',
|
|
17
|
+
item: items,
|
|
18
|
+
};
|
|
19
|
+
};
|
package/lib/v2/javdb/utils.js
CHANGED
|
@@ -7,7 +7,8 @@ const allowDomain = ['javdb.com', 'javdb36.com', 'javdb007.com'];
|
|
|
7
7
|
module.exports = {
|
|
8
8
|
ProcessItems: async (ctx, currentUrl, title) => {
|
|
9
9
|
const domain = ctx.query.domain ?? 'javdb.com';
|
|
10
|
-
|
|
10
|
+
const url = new URL(currentUrl, `https://${domain}`);
|
|
11
|
+
if (!config.feature.allow_user_supply_unsafe_domain && !allowDomain.includes(url.hostname)) {
|
|
11
12
|
ctx.throw(403, `This RSS is disabled unless 'ALLOW_USER_SUPPLY_UNSAFE_DOMAIN' is set to 'true'.`);
|
|
12
13
|
}
|
|
13
14
|
|
|
@@ -15,7 +16,7 @@ module.exports = {
|
|
|
15
16
|
|
|
16
17
|
const response = await got({
|
|
17
18
|
method: 'get',
|
|
18
|
-
url:
|
|
19
|
+
url: url.href,
|
|
19
20
|
});
|
|
20
21
|
|
|
21
22
|
const $ = cheerio.load(response.data);
|
|
@@ -68,11 +69,11 @@ module.exports = {
|
|
|
68
69
|
);
|
|
69
70
|
|
|
70
71
|
const htmlTitle = $('title').text();
|
|
71
|
-
const subject = htmlTitle.
|
|
72
|
+
const subject = htmlTitle.includes('|') ? htmlTitle.split('|')[0] : '';
|
|
72
73
|
|
|
73
74
|
return {
|
|
74
75
|
title: subject === '' ? title : `${subject} - ${title}`,
|
|
75
|
-
link:
|
|
76
|
+
link: url.href,
|
|
76
77
|
item: items,
|
|
77
78
|
};
|
|
78
79
|
},
|
package/lib/v2/jike/radar.js
CHANGED
|
@@ -30,5 +30,25 @@ module.exports = {
|
|
|
30
30
|
target: '/jike/topic/text/:id',
|
|
31
31
|
},
|
|
32
32
|
],
|
|
33
|
+
web: [
|
|
34
|
+
{
|
|
35
|
+
title: '用户动态',
|
|
36
|
+
docs: 'https://docs.rsshub.app/social-media.html#ji-ke',
|
|
37
|
+
source: '/u/:uid',
|
|
38
|
+
target: '/jike/user/:uid',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
title: '圈子',
|
|
42
|
+
docs: 'https://docs.rsshub.app/social-media.html#ji-ke',
|
|
43
|
+
source: '/topic/:id',
|
|
44
|
+
target: '/jike/topic/:id',
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
title: '圈子 - 纯文字',
|
|
48
|
+
docs: 'https://docs.rsshub.app/social-media.html#ji-ke',
|
|
49
|
+
source: '/topic/:id',
|
|
50
|
+
target: '/jike/topic/text/:id',
|
|
51
|
+
},
|
|
52
|
+
],
|
|
33
53
|
},
|
|
34
54
|
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
const cheerio = require('cheerio');
|
|
3
|
+
const timezone = require('@/utils/timezone');
|
|
4
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
5
|
+
|
|
6
|
+
module.exports = async (ctx) => {
|
|
7
|
+
let thePath = ctx.path.replace(/^\//, '');
|
|
8
|
+
|
|
9
|
+
if (/^f\d+-\d+/.test(thePath)) {
|
|
10
|
+
thePath = `fid=${thePath.match(/^f(\d+)-\d+/)[1]}`;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const limit = ctx.query.limit ? parseInt(ctx.query.limit, 10) : 30;
|
|
14
|
+
|
|
15
|
+
const rootUrl = 'https://keylol.com';
|
|
16
|
+
const currentUrl = new URL(`forum.php?mod=forumdisplay&${thePath.replace(/mod=\w+&/g, '')}`, rootUrl).href;
|
|
17
|
+
|
|
18
|
+
const { data: response } = await got(currentUrl);
|
|
19
|
+
|
|
20
|
+
const $ = cheerio.load(response);
|
|
21
|
+
|
|
22
|
+
let items = $('a.xst')
|
|
23
|
+
.slice(0, limit)
|
|
24
|
+
.toArray()
|
|
25
|
+
.map((item) => {
|
|
26
|
+
item = $(item);
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
title: item.text(),
|
|
30
|
+
link: new URL(item.prop('href').split('&extra=')[0], rootUrl).href,
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
items = await Promise.all(
|
|
35
|
+
items.map((item) =>
|
|
36
|
+
ctx.cache.tryGet(item.link, async () => {
|
|
37
|
+
const { data: detailResponse } = await got(item.link);
|
|
38
|
+
|
|
39
|
+
const content = cheerio.load(detailResponse);
|
|
40
|
+
|
|
41
|
+
item.description = content('td.t_f').html();
|
|
42
|
+
item.author = content('a.xw1').first().text();
|
|
43
|
+
item.category = content('#keyloL_thread_tags a')
|
|
44
|
+
.toArray()
|
|
45
|
+
.map((c) => content(c).text());
|
|
46
|
+
|
|
47
|
+
const pubDateEm = content('img.authicn').first().next();
|
|
48
|
+
const pubDateText = pubDateEm.find('span').prop('title') ?? pubDateEm.text();
|
|
49
|
+
const pubDateMatches = pubDateText.match(/(\d{4}-\d{1,2}-\d{1,2} \d{2}:\d{2}:\d{2})/) ?? undefined;
|
|
50
|
+
if (pubDateMatches) {
|
|
51
|
+
item.pubDate = timezone(parseDate(pubDateMatches[1], 'YYYY-M-D HH:mm:ss'), +8);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const updatedMatches =
|
|
55
|
+
content('i.pstatus')
|
|
56
|
+
.text()
|
|
57
|
+
.match(/(\d{4}-\d{1,2}-\d{1,2} \d{2}:\d{2}:\d{2})/) ?? undefined;
|
|
58
|
+
if (updatedMatches) {
|
|
59
|
+
item.updated = timezone(parseDate(updatedMatches[1], 'YYYY-M-D HH:mm:ss'), +8);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
item.comments = content('div.subforum_right_title_left_down').text() ? parseInt(content('div.subforum_right_title_left_down').text(), 10) : 0;
|
|
63
|
+
|
|
64
|
+
return item;
|
|
65
|
+
})
|
|
66
|
+
)
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
const icon = $('link[rel="apple-touch-icon"]').prop('href');
|
|
70
|
+
|
|
71
|
+
ctx.state.data = {
|
|
72
|
+
item: items,
|
|
73
|
+
title: $('title').text(),
|
|
74
|
+
link: currentUrl,
|
|
75
|
+
description: $('meta[name="description"]').prop('content'),
|
|
76
|
+
language: 'zh-cn',
|
|
77
|
+
icon,
|
|
78
|
+
logo: icon,
|
|
79
|
+
subtitle: $('meta[name="application-name"]').prop('content'),
|
|
80
|
+
author: $('meta[name="author"]').prop('content'),
|
|
81
|
+
};
|
|
82
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
'keylol.com': {
|
|
3
|
+
_name: '其乐',
|
|
4
|
+
'.': [
|
|
5
|
+
{
|
|
6
|
+
title: '论坛',
|
|
7
|
+
docs: 'https://docs.rsshub.app/game.html#qi-le-lun-tan',
|
|
8
|
+
source: ['/:category', '/'],
|
|
9
|
+
target: (params, url) => {
|
|
10
|
+
url = new URL(url);
|
|
11
|
+
const path = url.href.match(/keylol\.com\/(forum.php\?.*|f\d+-\d+)?/).replace(/forum.php\?/, '')[1];
|
|
12
|
+
|
|
13
|
+
return `/keylol${path ? `/${path}` : ''}`;
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
},
|
|
18
|
+
};
|
package/lib/v2/line/utils.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const got = require('@/utils/got');
|
|
2
2
|
const cheerio = require('cheerio');
|
|
3
3
|
const { parseDate } = require('@/utils/parse-date');
|
|
4
|
-
|
|
4
|
+
const logger = require('@/utils/logger');
|
|
5
5
|
const baseUrl = 'https://today.line.me';
|
|
6
6
|
|
|
7
7
|
const parseList = (items) =>
|
|
@@ -18,7 +18,23 @@ const parseItems = (list, tryGet) =>
|
|
|
18
18
|
list.map((item) =>
|
|
19
19
|
tryGet(item.link, async () => {
|
|
20
20
|
const edition = item.link.match(/today\.line\.me\/(\w+?)\/v2\/.*$/)[1];
|
|
21
|
-
|
|
21
|
+
let data;
|
|
22
|
+
try {
|
|
23
|
+
const response = await got(`${baseUrl}/webapi/portal/page/setting/article`, {
|
|
24
|
+
searchParams: {
|
|
25
|
+
country: edition,
|
|
26
|
+
hash: item.hash,
|
|
27
|
+
group: 'NA',
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
data = response.data;
|
|
31
|
+
} catch (error) {
|
|
32
|
+
if (error instanceof got.HTTPError && error.response.statusCode === 404) {
|
|
33
|
+
logger.error(`Error parsing article ${item.link}: ${error.message}`);
|
|
34
|
+
return item;
|
|
35
|
+
}
|
|
36
|
+
throw error;
|
|
37
|
+
}
|
|
22
38
|
|
|
23
39
|
const $ = cheerio.load(data.data.content, null, false);
|
|
24
40
|
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
const cheerio = require('cheerio');
|
|
3
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
4
|
+
|
|
5
|
+
module.exports = async (ctx) => {
|
|
6
|
+
const { appId, appSlug } = ctx.params;
|
|
7
|
+
const baseUrl = 'https://www.macupdate.com';
|
|
8
|
+
const link = `${baseUrl}/app/mac/${appId}${appSlug ? `/${appSlug}` : ''}`;
|
|
9
|
+
|
|
10
|
+
const { data: response } = await got(link);
|
|
11
|
+
const $ = cheerio.load(response);
|
|
12
|
+
|
|
13
|
+
const nextData = JSON.parse($('#__NEXT_DATA__').text());
|
|
14
|
+
|
|
15
|
+
const {
|
|
16
|
+
asPath,
|
|
17
|
+
appData: { data: appData },
|
|
18
|
+
} = nextData.props.initialProps.pageProps;
|
|
19
|
+
|
|
20
|
+
const item = {
|
|
21
|
+
title: `${appData.title} ${appData.version}`,
|
|
22
|
+
description: appData.release_notes,
|
|
23
|
+
pubDate: parseDate(appData.date.timestamp, 'X'),
|
|
24
|
+
link: `${baseUrl}${asPath}`,
|
|
25
|
+
guid: `macupdate/app/${appId}/${appData.version}`,
|
|
26
|
+
category: [appData.category.name, appData.subcategory?.name],
|
|
27
|
+
author: appData.developer.name,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
ctx.state.data = {
|
|
31
|
+
title: appData.title,
|
|
32
|
+
description: appData.description,
|
|
33
|
+
link: `${baseUrl}${asPath}`,
|
|
34
|
+
logo: appData.logo.source,
|
|
35
|
+
icon: appData.logo.source,
|
|
36
|
+
item: [item],
|
|
37
|
+
language: 'en',
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
ctx.state.json = {
|
|
41
|
+
pageProps: nextData.props.initialProps.pageProps,
|
|
42
|
+
};
|
|
43
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
'macupdate.com': {
|
|
3
|
+
_name: 'MacUpdate',
|
|
4
|
+
'.': [
|
|
5
|
+
{
|
|
6
|
+
title: '更新',
|
|
7
|
+
docs: 'https://docs.rsshub.app/program-update.html#macupdate',
|
|
8
|
+
source: ['/app/mac/:appId/:appSlug'],
|
|
9
|
+
target: '/macupdate/app/:appId/:appSlug?',
|
|
10
|
+
},
|
|
11
|
+
],
|
|
12
|
+
},
|
|
13
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
3
|
+
|
|
4
|
+
module.exports = async (ctx) => {
|
|
5
|
+
const { data } = await got('https://sec-in.com/api/v1/Common/getArticleList?tabs=newest');
|
|
6
|
+
const items = data.result.data.map((item) => ({
|
|
7
|
+
title: item.article_title,
|
|
8
|
+
link: `https://sec-in.com/article/${item.id}`,
|
|
9
|
+
description: item.summary,
|
|
10
|
+
pubDate: parseDate(item.passed_time),
|
|
11
|
+
author: item.member_info.nickname,
|
|
12
|
+
category: item.article_tag,
|
|
13
|
+
}));
|
|
14
|
+
ctx.state.data = {
|
|
15
|
+
title: 'SecIN信息安全技术社区',
|
|
16
|
+
link: 'https://sec-in.com/',
|
|
17
|
+
item: items,
|
|
18
|
+
};
|
|
19
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
// const { parseDate } = require('@/utils/parse-date');
|
|
3
|
+
|
|
4
|
+
module.exports = async (ctx) => {
|
|
5
|
+
const { data } = await got('https://www.sec-wiki.com/weekly/index');
|
|
6
|
+
const items = Array.from(data.matchAll(/\/weekly\/(\d+)">(.+?)<\/a><\/h5>\s*<p>(.+?)<\/p>/g)).map((item) => ({
|
|
7
|
+
title: item[2],
|
|
8
|
+
link: `https://www.sec-wiki.com/weekly/${item[1]}`,
|
|
9
|
+
description: item[3],
|
|
10
|
+
}));
|
|
11
|
+
ctx.state.data = {
|
|
12
|
+
title: 'SecWiki-安全维基',
|
|
13
|
+
link: 'https://www.sec-wiki.com/',
|
|
14
|
+
item: items,
|
|
15
|
+
};
|
|
16
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
const cheerio = require('cheerio');
|
|
3
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
4
|
+
|
|
5
|
+
const host = 'https://www.shu.edu.cn/';
|
|
6
|
+
const alias = new Map([
|
|
7
|
+
['news', 'zhxw'], // 综合新闻
|
|
8
|
+
['research', 'kydt1'], // 科研动态
|
|
9
|
+
['kydt', 'kydt1'], // 科研动态
|
|
10
|
+
['notice', 'tzgg'], // 通知公告
|
|
11
|
+
['important', 'zyxw'], // 重要新闻
|
|
12
|
+
]);
|
|
13
|
+
|
|
14
|
+
module.exports = async (ctx) => {
|
|
15
|
+
const type = ctx.params.type || 'news';
|
|
16
|
+
const link = `https://www.shu.edu.cn/${alias.get(type) || type}.htm`;
|
|
17
|
+
const respond = await got.get(link);
|
|
18
|
+
const $ = cheerio.load(respond.data);
|
|
19
|
+
const title = $('title').text();
|
|
20
|
+
const list = $('.ej_main .list')
|
|
21
|
+
.find('li')
|
|
22
|
+
.slice(0, 5)
|
|
23
|
+
.toArray()
|
|
24
|
+
.map((ele) => ({
|
|
25
|
+
title: $(ele).find('.bt').text(),
|
|
26
|
+
link: new URL($(ele).find('a').attr('href'), host).href,
|
|
27
|
+
date: $(ele).find('.sj').text(),
|
|
28
|
+
}));
|
|
29
|
+
|
|
30
|
+
const all = await Promise.all(
|
|
31
|
+
list.map((item) =>
|
|
32
|
+
ctx.cache.tryGet(item.link, async () => {
|
|
33
|
+
const response = await got.get(item.link);
|
|
34
|
+
const $ = cheerio.load(response.data);
|
|
35
|
+
item.author = $('.xx>:nth-child(2)').text().trim().slice(3); // 投稿:xxx
|
|
36
|
+
item.pubDate = parseDate(item.date, 'YYYY.MM.DD');
|
|
37
|
+
item.description = $('.v_news_content').html() || item.title;
|
|
38
|
+
return item;
|
|
39
|
+
})
|
|
40
|
+
)
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
ctx.state.data = {
|
|
44
|
+
title,
|
|
45
|
+
link,
|
|
46
|
+
item: all,
|
|
47
|
+
};
|
|
48
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
const cheerio = require('cheerio');
|
|
3
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
4
|
+
|
|
5
|
+
const host = 'https://jwb.shu.edu.cn/';
|
|
6
|
+
const alias = new Map([
|
|
7
|
+
['notice', 'tzgg'], // 通知公告
|
|
8
|
+
['news', 'xw'], // 新闻动态
|
|
9
|
+
['policy', 'zcwj'], // 政策文件
|
|
10
|
+
]);
|
|
11
|
+
|
|
12
|
+
module.exports = async (ctx) => {
|
|
13
|
+
const type = ctx.params.type || 'notice';
|
|
14
|
+
const link = `https://jwb.shu.edu.cn/index/${alias.get(type) || type}.htm`;
|
|
15
|
+
const respond = await got.get(link);
|
|
16
|
+
const $ = cheerio.load(respond.data);
|
|
17
|
+
const title = $('title').text();
|
|
18
|
+
const list = $('.only-list')
|
|
19
|
+
.find('li')
|
|
20
|
+
.slice(0, 10)
|
|
21
|
+
.toArray()
|
|
22
|
+
.map((ele) => ({
|
|
23
|
+
title: $(ele).find('a').text(),
|
|
24
|
+
link: new URL($(ele).find('a').attr('href'), host).href,
|
|
25
|
+
date: $(ele).children('span').text(),
|
|
26
|
+
}));
|
|
27
|
+
|
|
28
|
+
const all = await Promise.all(
|
|
29
|
+
list.map((item) =>
|
|
30
|
+
ctx.cache.tryGet(item.link, async () => {
|
|
31
|
+
const response = await got.get(item.link);
|
|
32
|
+
const $ = cheerio.load(response.data);
|
|
33
|
+
item.author = $('[id$=_lblUser]').text().trim();
|
|
34
|
+
item.pubDate = parseDate(item.date, 'YYYY年MM月DD日');
|
|
35
|
+
item.description = $('.v_news_content').html() || item.title;
|
|
36
|
+
return item;
|
|
37
|
+
})
|
|
38
|
+
)
|
|
39
|
+
);
|
|
40
|
+
ctx.state.data = {
|
|
41
|
+
title,
|
|
42
|
+
link,
|
|
43
|
+
item: all,
|
|
44
|
+
};
|
|
45
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
'shu.edu.cn': {
|
|
3
|
+
_name: '上海大学',
|
|
4
|
+
jwb: [
|
|
5
|
+
{
|
|
6
|
+
title: '教务处通知公告',
|
|
7
|
+
docs: 'https://docs.rsshub.app/university.html#shang-hai-da-xue',
|
|
8
|
+
source: ['/index/:type'],
|
|
9
|
+
target: '/shu/jwb/:type',
|
|
10
|
+
},
|
|
11
|
+
],
|
|
12
|
+
www: [
|
|
13
|
+
{
|
|
14
|
+
title: '官网信息',
|
|
15
|
+
docs: 'https://docs.rsshub.app/university.html#shang-hai-da-xue',
|
|
16
|
+
source: ['/:type'],
|
|
17
|
+
target: '/shu/:type',
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
};
|
|
@@ -11,7 +11,7 @@ module.exports = async (ctx) => {
|
|
|
11
11
|
const { data: response } = await got(url);
|
|
12
12
|
const $ = cheerio.load(response);
|
|
13
13
|
|
|
14
|
-
const items = $('.col-md-
|
|
14
|
+
const items = $('.moreNews > .col-md-4 .media-body > .my-2 > a')
|
|
15
15
|
.toArray()
|
|
16
16
|
.map((item) => {
|
|
17
17
|
item = $(item);
|
package/lib/v2/wikinews/index.js
CHANGED
|
@@ -1,43 +1,42 @@
|
|
|
1
1
|
const got = require('@/utils/got');
|
|
2
|
-
const { parseString } = require('xml2js');
|
|
3
2
|
const cheerio = require('cheerio');
|
|
4
3
|
const currentURL = 'https://zh.wikinews.org/wiki/Special:%E6%96%B0%E9%97%BB%E8%AE%A2%E9%98%85';
|
|
5
4
|
const { parseDate } = require('@/utils/parse-date');
|
|
6
5
|
|
|
7
6
|
module.exports = async (ctx) => {
|
|
8
7
|
const resp = await got(currentURL);
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
const $ = cheerio.load(resp.data);
|
|
9
|
+
const urls = $('url')
|
|
10
|
+
.toArray()
|
|
11
|
+
.map((item) => {
|
|
12
|
+
item = $(item);
|
|
13
|
+
return {
|
|
14
|
+
title: item.find('news\\:title').text(),
|
|
15
|
+
pubDate: parseDate(item.find('news\\:publication_date').text()),
|
|
16
|
+
category: item
|
|
17
|
+
.find('news\\:keywords')
|
|
18
|
+
.text()
|
|
19
|
+
.split(',')
|
|
20
|
+
.map((item) => item.trim()),
|
|
21
|
+
link: item.find('loc').text(),
|
|
22
|
+
};
|
|
18
23
|
});
|
|
19
|
-
|
|
24
|
+
|
|
25
|
+
const items = await Promise.all(
|
|
26
|
+
urls.map((item) =>
|
|
27
|
+
ctx.cache.tryGet(item.link, async () => {
|
|
28
|
+
const resp = await got(item.link);
|
|
29
|
+
const $ = cheerio.load(resp.data);
|
|
30
|
+
item.description = $('#bodyContent').html();
|
|
31
|
+
|
|
32
|
+
return item;
|
|
33
|
+
})
|
|
34
|
+
)
|
|
35
|
+
);
|
|
20
36
|
|
|
21
37
|
ctx.state.data = {
|
|
22
38
|
title: '最新新闻 - 维基新闻',
|
|
23
39
|
link: currentURL,
|
|
24
|
-
item:
|
|
25
|
-
urls.map(async (url) => {
|
|
26
|
-
const loc = url.loc[0];
|
|
27
|
-
const news = url['news:news'][0];
|
|
28
|
-
const description = await ctx.cache.tryGet(loc, async () => {
|
|
29
|
-
const resp = await got(loc);
|
|
30
|
-
const $ = cheerio.load(resp.data);
|
|
31
|
-
return $('#bodyContent').html();
|
|
32
|
-
});
|
|
33
|
-
return {
|
|
34
|
-
title: news['news:title'][0],
|
|
35
|
-
pubDate: parseDate(news['news:publication_date'][0]),
|
|
36
|
-
category: news['news:keywords'][0].split(',').map((item) => item.trim()),
|
|
37
|
-
link: loc,
|
|
38
|
-
description,
|
|
39
|
-
};
|
|
40
|
-
})
|
|
41
|
-
),
|
|
40
|
+
item: items,
|
|
42
41
|
};
|
|
43
42
|
};
|