rsshub 1.0.0-master.baeafb9 → 1.0.0-master.bb80a2e
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/README.md +4 -3
- package/lib/config.js +4 -0
- package/lib/middleware/cache/index.js +3 -3
- package/lib/middleware/cache/memory.js +5 -11
- package/lib/router.js +23 -22
- package/lib/routes/amd/graphicsdrivers.js +1 -1
- package/lib/routes/weibo/keyword.js +18 -10
- package/lib/routes/weibo/super_index.js +24 -15
- package/lib/routes/weibo/timeline.js +37 -14
- package/lib/routes/weibo/user.js +42 -18
- package/lib/routes/weibo/utils.js +39 -0
- package/lib/utils/parse-date.js +171 -17
- package/lib/utils/torrent.js +9 -1
- package/lib/v2/asus/bios.js +38 -0
- package/lib/v2/asus/maintainer.js +3 -0
- package/lib/v2/asus/radar.js +13 -0
- package/lib/v2/asus/router.js +3 -0
- package/lib/v2/asus/templates/bios.art +6 -0
- package/lib/v2/douban/people/status.js +10 -2
- package/lib/v2/douban/people/wish.js +55 -43
- package/lib/v2/gov/anhui/kjt.js +56 -0
- package/lib/v2/gov/maintainer.js +1 -0
- package/lib/v2/gov/radar.js +90 -76
- package/lib/v2/gov/router.js +1 -0
- package/lib/v2/hupu/all.js +73 -0
- package/lib/v2/hupu/bbs.js +64 -0
- package/lib/v2/hupu/index.js +72 -0
- package/lib/v2/hupu/maintainer.js +7 -0
- package/lib/v2/hupu/radar.js +35 -0
- package/lib/v2/hupu/router.js +7 -0
- package/lib/v2/hupu/templates/description.art +6 -0
- package/lib/{routes → v2}/ifeng/feng.js +7 -5
- package/lib/v2/ifeng/maintainer.js +3 -0
- package/lib/v2/ifeng/radar.js +11 -0
- package/lib/v2/ifeng/router.js +3 -0
- package/lib/{routes → v2}/ifeng/utils.js +0 -0
- package/lib/v2/kakuyomu/episode.js +54 -0
- package/lib/v2/kakuyomu/maintainer.js +3 -0
- package/lib/v2/kakuyomu/radar.js +13 -0
- package/lib/v2/kakuyomu/router.js +1 -0
- package/lib/v2/mihoyo/bbs.js +62 -0
- package/lib/v2/mihoyo/maintainer.js +3 -0
- package/lib/v2/mihoyo/radar.js +31 -0
- package/lib/v2/mihoyo/router.js +3 -0
- package/lib/v2/mihoyo/templates/description.art +6 -0
- package/lib/{routes → v2}/mpaypass/main.js +23 -27
- package/lib/v2/mpaypass/maintainer.js +4 -0
- package/lib/v2/mpaypass/news.js +39 -0
- package/lib/v2/mpaypass/radar.js +19 -0
- package/lib/v2/mpaypass/router.js +4 -0
- package/lib/v2/natgeo/dailyphoto.js +32 -0
- package/lib/v2/natgeo/dailyselection.js +41 -0
- package/lib/v2/natgeo/maintainer.js +5 -0
- package/lib/{routes → v2}/natgeo/natgeo.js +18 -32
- package/lib/v2/natgeo/radar.js +24 -0
- package/lib/v2/natgeo/router.js +5 -0
- package/lib/v2/natgeo/templates/dailyPhoto.art +5 -0
- package/lib/v2/nuaa/cs/index.js +87 -0
- package/lib/v2/nuaa/jwc/jwc.js +82 -0
- package/lib/v2/nuaa/maintainer.js +5 -0
- package/lib/v2/nuaa/radar.js +23 -0
- package/lib/v2/nuaa/router.js +5 -0
- package/lib/{routes/universities → v2}/nuaa/utils/pypasswaf.js +1 -1
- package/lib/{routes/universities → v2}/nuaa/yjsy/yjsy.js +16 -22
- package/lib/v2/picuki/profile.js +12 -3
- package/lib/v2/pubmed/maintainer.js +3 -0
- package/lib/v2/pubmed/radar.js +13 -0
- package/lib/v2/pubmed/router.js +3 -0
- package/lib/v2/pubmed/templates/description.art +7 -0
- package/lib/v2/pubmed/trending.js +58 -0
- package/lib/v2/qweather/3days.js +46 -0
- package/lib/v2/qweather/maintainer.js +4 -0
- package/lib/v2/qweather/now.js +46 -0
- package/lib/v2/qweather/router.js +4 -0
- package/lib/v2/qweather/util/3days.art +20 -0
- package/lib/v2/qweather/util/now.art +16 -0
- package/lib/v2/telegram/channel.js +10 -6
- package/lib/v2/test/index.js +1 -1
- package/lib/{routes → v2}/thepaper/839studio/category.js +0 -0
- package/lib/{routes → v2}/thepaper/839studio/studio.js +0 -0
- package/lib/{routes → v2}/thepaper/channel.js +0 -0
- package/lib/v2/thepaper/factpaper.js +61 -0
- package/lib/{routes → v2}/thepaper/featured.js +0 -0
- package/lib/{routes → v2}/thepaper/list.js +0 -0
- package/lib/v2/thepaper/maintainer.js +8 -0
- package/lib/v2/thepaper/radar.js +42 -0
- package/lib/v2/thepaper/router.js +8 -0
- package/lib/v2/thepaper/templates/factpaper.art +12 -0
- package/lib/v2/thepaper/utils.js +55 -0
- package/lib/v2/zooTeam/blog.js +32 -0
- package/lib/v2/zooTeam/maintainer.js +4 -0
- package/lib/v2/zooTeam/radar.js +21 -0
- package/lib/v2/zooTeam/router.js +4 -0
- package/lib/v2/zooTeam/weekly.js +34 -0
- package/package.json +12 -8
- package/lib/routes/hupu/all.js +0 -53
- package/lib/routes/hupu/bbs.js +0 -83
- package/lib/routes/hupu/dept.js +0 -66
- package/lib/routes/mpaypass/news.js +0 -43
- package/lib/routes/natgeo/dailyphoto.js +0 -27
- package/lib/routes/pubmed/trending.js +0 -65
- package/lib/routes/thepaper/utils.js +0 -48
- package/lib/routes/universities/nuaa/cs/index.js +0 -84
- package/lib/routes/universities/nuaa/jwc/jwc.js +0 -105
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
const timezone = require('@/utils/timezone');
|
|
3
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
4
|
+
|
|
5
|
+
module.exports = async (ctx) => {
|
|
6
|
+
const response = await got({
|
|
7
|
+
method: 'get',
|
|
8
|
+
url: 'https://weekly.zoo.team:3030/api/lastest/list',
|
|
9
|
+
});
|
|
10
|
+
const data = response.data.data;
|
|
11
|
+
ctx.state.data = {
|
|
12
|
+
// 源标题
|
|
13
|
+
title: '政采云前端小报',
|
|
14
|
+
// 源链接
|
|
15
|
+
link: 'https://weekly.zoo.team/',
|
|
16
|
+
// 源说明
|
|
17
|
+
description: '政采云前端小报',
|
|
18
|
+
// 有可能接口返回为空
|
|
19
|
+
allowEmpty: true,
|
|
20
|
+
// 遍历此前获取的数据
|
|
21
|
+
item: data.map((item) => ({
|
|
22
|
+
// 文章标题
|
|
23
|
+
title: item.title,
|
|
24
|
+
// 文章正文
|
|
25
|
+
description: item.description,
|
|
26
|
+
// 文章发布时间
|
|
27
|
+
pubDate: timezone(parseDate(item.timestamp * 1000), +8),
|
|
28
|
+
// 文章链接
|
|
29
|
+
link: item.link,
|
|
30
|
+
// 分类
|
|
31
|
+
category: item.category,
|
|
32
|
+
})),
|
|
33
|
+
};
|
|
34
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rsshub",
|
|
3
|
-
"version": "1.0.0-master.
|
|
3
|
+
"version": "1.0.0-master.bb80a2e",
|
|
4
4
|
"description": "Make RSS Great Again!",
|
|
5
5
|
"main": "lib/pkg.js",
|
|
6
6
|
"files": [
|
|
@@ -48,9 +48,10 @@
|
|
|
48
48
|
"@vuepress/plugin-back-to-top": "1.9.7",
|
|
49
49
|
"@vuepress/plugin-google-analytics": "1.9.7",
|
|
50
50
|
"@vuepress/plugin-pwa": "1.9.7",
|
|
51
|
+
"@vuepress/shared-utils": "1.9.7",
|
|
51
52
|
"ci-info": "3.3.0",
|
|
52
53
|
"cross-env": "7.0.3",
|
|
53
|
-
"eslint": "8.
|
|
54
|
+
"eslint": "8.12.0",
|
|
54
55
|
"eslint-config-prettier": "8.5.0",
|
|
55
56
|
"eslint-plugin-prettier": "4.0.0",
|
|
56
57
|
"eslint-plugin-yml": "0.14.0",
|
|
@@ -59,7 +60,7 @@
|
|
|
59
60
|
"mockdate": "3.0.5",
|
|
60
61
|
"nock": "13.2.4",
|
|
61
62
|
"nodemon": "2.0.15",
|
|
62
|
-
"prettier": "2.6.
|
|
63
|
+
"prettier": "2.6.1",
|
|
63
64
|
"prettier-check": "2.0.0",
|
|
64
65
|
"pretty-quick": "3.1.3",
|
|
65
66
|
"remark": "13.0.0",
|
|
@@ -78,7 +79,7 @@
|
|
|
78
79
|
"dependencies": {
|
|
79
80
|
"@koa/router": "10.1.1",
|
|
80
81
|
"@postlight/mercury-parser": "2.2.1",
|
|
81
|
-
"@sentry/node": "6.19.
|
|
82
|
+
"@sentry/node": "6.19.2",
|
|
82
83
|
"aes-js": "3.1.2",
|
|
83
84
|
"art-template": "4.13.2",
|
|
84
85
|
"bbcodejs": "0.0.4",
|
|
@@ -94,12 +95,12 @@
|
|
|
94
95
|
"etag": "1.8.1",
|
|
95
96
|
"fanfou-sdk": "4.2.0",
|
|
96
97
|
"git-rev-sync": "3.0.2",
|
|
97
|
-
"googleapis": "
|
|
98
|
+
"googleapis": "99.0.0",
|
|
98
99
|
"got": "11.8.3",
|
|
99
100
|
"https-proxy-agent": "5.0.0",
|
|
100
101
|
"iconv-lite": "0.6.3",
|
|
101
102
|
"instagram-private-api": "1.45.3",
|
|
102
|
-
"ioredis": "
|
|
103
|
+
"ioredis": "5.0.1",
|
|
103
104
|
"ip": "*",
|
|
104
105
|
"ip-regex": "4.3.0",
|
|
105
106
|
"is-localhost-ip": "1.4.0",
|
|
@@ -115,9 +116,9 @@
|
|
|
115
116
|
"mailparser": "3.4.0",
|
|
116
117
|
"markdown-it": "12.3.2",
|
|
117
118
|
"module-alias": "2.2.2",
|
|
118
|
-
"parse-torrent": "9.1.
|
|
119
|
+
"parse-torrent": "9.1.5",
|
|
119
120
|
"pidusage": "3.0.0",
|
|
120
|
-
"plist": "3.0.
|
|
121
|
+
"plist": "3.0.5",
|
|
121
122
|
"puppeteer": "13.5.1",
|
|
122
123
|
"query-string": "7.1.1",
|
|
123
124
|
"require-all": "3.0.0",
|
|
@@ -158,5 +159,8 @@
|
|
|
158
159
|
},
|
|
159
160
|
"nodemonConfig": {
|
|
160
161
|
"ext": "art,js,mjs,json"
|
|
162
|
+
},
|
|
163
|
+
"engines": {
|
|
164
|
+
"node": ">=14"
|
|
161
165
|
}
|
|
162
166
|
}
|
package/lib/routes/hupu/all.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
const got = require('@/utils/got');
|
|
2
|
-
const cheerio = require('cheerio');
|
|
3
|
-
|
|
4
|
-
module.exports = async (ctx) => {
|
|
5
|
-
const rootUrl = 'https://bbs.hupu.com';
|
|
6
|
-
const currentUrl = `${rootUrl}/all-${ctx.params.caty}`;
|
|
7
|
-
|
|
8
|
-
const response = await got({
|
|
9
|
-
method: 'get',
|
|
10
|
-
url: currentUrl,
|
|
11
|
-
});
|
|
12
|
-
const $ = cheerio.load(response.data);
|
|
13
|
-
|
|
14
|
-
const list = $('div.list ul li')
|
|
15
|
-
.slice(0, 20)
|
|
16
|
-
.map((_, item) => {
|
|
17
|
-
item = $(item);
|
|
18
|
-
const a = item.find('span.textSpan a[title]');
|
|
19
|
-
return {
|
|
20
|
-
title: a.attr('title'),
|
|
21
|
-
link: `${rootUrl}${a.attr('href')}`,
|
|
22
|
-
};
|
|
23
|
-
})
|
|
24
|
-
.get();
|
|
25
|
-
|
|
26
|
-
const items = await Promise.all(
|
|
27
|
-
list.map((item) =>
|
|
28
|
-
ctx.cache.tryGet(item.link, async () => {
|
|
29
|
-
try {
|
|
30
|
-
const detailResponse = await got({
|
|
31
|
-
method: 'get',
|
|
32
|
-
url: item.link,
|
|
33
|
-
});
|
|
34
|
-
const content = cheerio.load(detailResponse.data);
|
|
35
|
-
|
|
36
|
-
item.description = content('div.quote-content').html();
|
|
37
|
-
item.author = content('div.author div.left a.u').eq(0).text();
|
|
38
|
-
item.pubDate = new Date(content('span.stime').eq(0).text() + ' GMT+8').toUTCString();
|
|
39
|
-
|
|
40
|
-
return item;
|
|
41
|
-
} catch (error) {
|
|
42
|
-
return Promise.resolve('');
|
|
43
|
-
}
|
|
44
|
-
})
|
|
45
|
-
)
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
ctx.state.data = {
|
|
49
|
-
title: $('title').text(),
|
|
50
|
-
link: currentUrl,
|
|
51
|
-
item: items,
|
|
52
|
-
};
|
|
53
|
-
};
|
package/lib/routes/hupu/bbs.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
const got = require('@/utils/got');
|
|
2
|
-
const cheerio = require('cheerio');
|
|
3
|
-
const url = require('url');
|
|
4
|
-
|
|
5
|
-
const host = 'https://bbs.hupu.com';
|
|
6
|
-
|
|
7
|
-
module.exports = async (ctx) => {
|
|
8
|
-
const id = ctx.params.id;
|
|
9
|
-
const order = ctx.params.order || 1;
|
|
10
|
-
|
|
11
|
-
let link = `https://bbs.hupu.com/${id}`;
|
|
12
|
-
|
|
13
|
-
let order_name;
|
|
14
|
-
if (parseInt(order) === 1) {
|
|
15
|
-
order_name = '最新回帖';
|
|
16
|
-
} else if (parseInt(order) === 2) {
|
|
17
|
-
order_name = '最新发帖';
|
|
18
|
-
link += '-postdate-1';
|
|
19
|
-
} else if (parseInt(order) === 3) {
|
|
20
|
-
order_name = '精华';
|
|
21
|
-
link += '-digest';
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const response = await got.get(link);
|
|
25
|
-
const $ = cheerio.load(response.data);
|
|
26
|
-
|
|
27
|
-
const type_name = $('span.infoname').text();
|
|
28
|
-
const description = $('#des_forum').text();
|
|
29
|
-
|
|
30
|
-
const list = $('ul.for-list li')
|
|
31
|
-
.slice(0, 10)
|
|
32
|
-
.map(function () {
|
|
33
|
-
const info = {
|
|
34
|
-
title: $(this).find('div.titlelink.box > a.truetit').text().trim(),
|
|
35
|
-
link: $(this).find('div.titlelink.box > a.truetit').attr('href'),
|
|
36
|
-
author: $(this).find('a.aulink').text(),
|
|
37
|
-
};
|
|
38
|
-
return info;
|
|
39
|
-
})
|
|
40
|
-
.get();
|
|
41
|
-
|
|
42
|
-
for (let i = list.length - 1; i >= 0; i--) {
|
|
43
|
-
if (!list[i].link.endsWith('html')) {
|
|
44
|
-
list.splice(i, 1);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const out = await Promise.all(
|
|
49
|
-
list.map(async (info) => {
|
|
50
|
-
const title = info.title;
|
|
51
|
-
const itemUrl = url.resolve(host, info.link);
|
|
52
|
-
const author = info.author;
|
|
53
|
-
|
|
54
|
-
const cache = await ctx.cache.get(itemUrl);
|
|
55
|
-
if (cache) {
|
|
56
|
-
return Promise.resolve(JSON.parse(cache));
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const response = await got.get(itemUrl);
|
|
60
|
-
const $ = cheerio.load(response.data);
|
|
61
|
-
|
|
62
|
-
const date = $('#tpc span.stime').text();
|
|
63
|
-
const description = $('div.quote-content').html();
|
|
64
|
-
|
|
65
|
-
const single = {
|
|
66
|
-
title,
|
|
67
|
-
link: itemUrl,
|
|
68
|
-
author,
|
|
69
|
-
description,
|
|
70
|
-
pubDate: new Date(date).toUTCString(),
|
|
71
|
-
};
|
|
72
|
-
ctx.cache.set(itemUrl, JSON.stringify(single));
|
|
73
|
-
return Promise.resolve(single);
|
|
74
|
-
})
|
|
75
|
-
);
|
|
76
|
-
|
|
77
|
-
ctx.state.data = {
|
|
78
|
-
title: `${type_name}${order_name}——虎扑步行街`,
|
|
79
|
-
link,
|
|
80
|
-
description,
|
|
81
|
-
item: out,
|
|
82
|
-
};
|
|
83
|
-
};
|
package/lib/routes/hupu/dept.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
const got = require('@/utils/got');
|
|
2
|
-
const cheerio = require('cheerio');
|
|
3
|
-
|
|
4
|
-
module.exports = async (ctx) => {
|
|
5
|
-
let currentUrl = '';
|
|
6
|
-
if (ctx.params.dept === 'soccer-china') {
|
|
7
|
-
currentUrl = `https://soccer.hupu.com/china`;
|
|
8
|
-
} else {
|
|
9
|
-
currentUrl = `https://${ctx.params.dept}.hupu.com`;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const response = await got({
|
|
13
|
-
method: 'get',
|
|
14
|
-
url: currentUrl,
|
|
15
|
-
});
|
|
16
|
-
const $ = cheerio.load(response.data);
|
|
17
|
-
|
|
18
|
-
const query = {
|
|
19
|
-
nba: 'div.list-item',
|
|
20
|
-
soccer: 'div.list-item',
|
|
21
|
-
'soccer-china': '#focusNews',
|
|
22
|
-
cba: '#focusNews',
|
|
23
|
-
gg: 'div.fouce-news',
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const list = $(query[ctx.params.dept])
|
|
27
|
-
.find('a[href!=""]')
|
|
28
|
-
.slice(0, 20)
|
|
29
|
-
.map((_, item) => {
|
|
30
|
-
item = $(item);
|
|
31
|
-
|
|
32
|
-
return {
|
|
33
|
-
title: item.text(),
|
|
34
|
-
link: item.attr('href'),
|
|
35
|
-
};
|
|
36
|
-
})
|
|
37
|
-
.get();
|
|
38
|
-
|
|
39
|
-
const items = await Promise.all(
|
|
40
|
-
list.map((item) =>
|
|
41
|
-
ctx.cache.tryGet(item.link, async () => {
|
|
42
|
-
try {
|
|
43
|
-
const detailResponse = await got({
|
|
44
|
-
method: 'get',
|
|
45
|
-
url: item.link,
|
|
46
|
-
});
|
|
47
|
-
const content = cheerio.load(detailResponse.data);
|
|
48
|
-
|
|
49
|
-
item.description = content('div.quote-content').html();
|
|
50
|
-
item.author = content('div.author div.left a.u').eq(0).text();
|
|
51
|
-
item.pubDate = new Date(content('span.stime').eq(0).text() + ' GMT+8').toUTCString();
|
|
52
|
-
|
|
53
|
-
return item;
|
|
54
|
-
} catch (error) {
|
|
55
|
-
return Promise.resolve('');
|
|
56
|
-
}
|
|
57
|
-
})
|
|
58
|
-
)
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
ctx.state.data = {
|
|
62
|
-
title: $('title').text(),
|
|
63
|
-
link: currentUrl,
|
|
64
|
-
item: items,
|
|
65
|
-
};
|
|
66
|
-
};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
const got = require('@/utils/got');
|
|
2
|
-
const cheerio = require('cheerio');
|
|
3
|
-
|
|
4
|
-
module.exports = async (ctx) => {
|
|
5
|
-
const link = `http://m.mpaypass.com.cn/`;
|
|
6
|
-
const listData = await got.get(link);
|
|
7
|
-
const $list = cheerio.load(listData.data);
|
|
8
|
-
ctx.state.data = {
|
|
9
|
-
title: `新闻 - 移动支付网`,
|
|
10
|
-
link,
|
|
11
|
-
item: await Promise.all(
|
|
12
|
-
$list('.newsbodylist')
|
|
13
|
-
.map(async (_, el) => {
|
|
14
|
-
const $el = $list(el);
|
|
15
|
-
const $a = $el.find('.newsbodylist-title a');
|
|
16
|
-
const href = $a.attr('href');
|
|
17
|
-
const title = $a.text();
|
|
18
|
-
const date = $el.find('.newsbodylist-title span').text().split('|')[1];
|
|
19
|
-
|
|
20
|
-
const key = href;
|
|
21
|
-
let description;
|
|
22
|
-
const value = await ctx.cache.get(key);
|
|
23
|
-
|
|
24
|
-
if (value) {
|
|
25
|
-
description = value;
|
|
26
|
-
} else {
|
|
27
|
-
const contentData = await got.get(href);
|
|
28
|
-
const $content = cheerio.load(contentData.data);
|
|
29
|
-
description = $content('.newsbody').html();
|
|
30
|
-
ctx.cache.set(key, description);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return {
|
|
34
|
-
title,
|
|
35
|
-
description,
|
|
36
|
-
link: href,
|
|
37
|
-
pubDate: new Date(date).toUTCString(),
|
|
38
|
-
};
|
|
39
|
-
})
|
|
40
|
-
.get()
|
|
41
|
-
),
|
|
42
|
-
};
|
|
43
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
const got = require('@/utils/got');
|
|
2
|
-
|
|
3
|
-
module.exports = async (ctx) => {
|
|
4
|
-
const today = new Date();
|
|
5
|
-
const year = today.getFullYear();
|
|
6
|
-
const month = today.getMonth() + 1;
|
|
7
|
-
|
|
8
|
-
const api = `https://www.nationalgeographic.com/content/photography/en_US/photo-of-the-day/_jcr_content/.gallery.${year}-${month}.json`;
|
|
9
|
-
const response = await got.get(api);
|
|
10
|
-
const items = response.data.items;
|
|
11
|
-
|
|
12
|
-
const out = items.slice(0, 10).map((item) => {
|
|
13
|
-
const info = {
|
|
14
|
-
title: item.image.title,
|
|
15
|
-
author: item.image.credit && item.image.credit.replace('Photograph by ', ''),
|
|
16
|
-
link: item.pageUrl,
|
|
17
|
-
description: `<img src="${item.image.uri}">` + item.image.caption,
|
|
18
|
-
};
|
|
19
|
-
return info;
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
ctx.state.data = {
|
|
23
|
-
title: 'Photo of the Day',
|
|
24
|
-
link: 'https://www.nationalgeographic.com/photography/photo-of-the-day/',
|
|
25
|
-
item: out,
|
|
26
|
-
};
|
|
27
|
-
};
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
const got = require('@/utils/got');
|
|
2
|
-
const cheerio = require('cheerio');
|
|
3
|
-
const url = require('url');
|
|
4
|
-
const date = require('@/utils/date');
|
|
5
|
-
|
|
6
|
-
const base = 'https://pubmed.ncbi.nlm.nih.gov';
|
|
7
|
-
|
|
8
|
-
module.exports = async (ctx) => {
|
|
9
|
-
const link = `${base}/trending/`;
|
|
10
|
-
const response = await got.get(encodeURI(link));
|
|
11
|
-
const pageCapture = cheerio.load(response.data);
|
|
12
|
-
|
|
13
|
-
const list = pageCapture('.docsum-content')
|
|
14
|
-
.map((_, elem) => {
|
|
15
|
-
const $ = cheerio.load(elem);
|
|
16
|
-
const partial = $('a').attr('href');
|
|
17
|
-
return {
|
|
18
|
-
title: $('a').text().trim(),
|
|
19
|
-
link: url.resolve(base, partial),
|
|
20
|
-
author: $('.full-authors').text(),
|
|
21
|
-
};
|
|
22
|
-
})
|
|
23
|
-
.get();
|
|
24
|
-
|
|
25
|
-
const out = await Promise.all(
|
|
26
|
-
list.map((item) =>
|
|
27
|
-
ctx.cache.tryGet(item.link, async () => {
|
|
28
|
-
const detail = await got.get(item.link);
|
|
29
|
-
const detailCapture = cheerio.load(detail.data);
|
|
30
|
-
|
|
31
|
-
item.doi = detailCapture('meta[name="citation_doi"]').attr('content');
|
|
32
|
-
item.pubDate = date(detailCapture('meta[name="citation_date"]').attr('content'));
|
|
33
|
-
|
|
34
|
-
let authorContents = '';
|
|
35
|
-
if (item.author !== '') {
|
|
36
|
-
authorContents = `
|
|
37
|
-
<div id="author-content">
|
|
38
|
-
<span style="color: grey">${item.author}</span>
|
|
39
|
-
</div>
|
|
40
|
-
`;
|
|
41
|
-
}
|
|
42
|
-
const abs = detailCapture('#enc-abstract').html();
|
|
43
|
-
let absContents = '';
|
|
44
|
-
if (abs !== null) {
|
|
45
|
-
absContents = `
|
|
46
|
-
<div id="abstract-content">
|
|
47
|
-
<h2 align="left">Abstract</h2>
|
|
48
|
-
<p>${abs}</p>
|
|
49
|
-
</div>
|
|
50
|
-
`;
|
|
51
|
-
}
|
|
52
|
-
item.description = authorContents + absContents;
|
|
53
|
-
|
|
54
|
-
return item;
|
|
55
|
-
})
|
|
56
|
-
)
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
ctx.state.data = {
|
|
60
|
-
title: 'PubMed | Trending Articles',
|
|
61
|
-
description: 'Trending Articles from PubMed Website',
|
|
62
|
-
link,
|
|
63
|
-
item: out,
|
|
64
|
-
};
|
|
65
|
-
};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
const cheerio = require('cheerio');
|
|
2
|
-
const date = require('@/utils/date');
|
|
3
|
-
const got = require('@/utils/got');
|
|
4
|
-
|
|
5
|
-
module.exports = {
|
|
6
|
-
ProcessFeed: async (query, link, ctx) => {
|
|
7
|
-
const res = await got.get(link);
|
|
8
|
-
|
|
9
|
-
const $ = cheerio.load(res.data);
|
|
10
|
-
const list = $(query).slice(0, 10).get();
|
|
11
|
-
|
|
12
|
-
return Promise.all(
|
|
13
|
-
list.map(async (item) => {
|
|
14
|
-
const $ = cheerio.load(item);
|
|
15
|
-
const itemUrl = `https://m.thepaper.cn/${$(item).find('a').eq(0).attr('href')}`;
|
|
16
|
-
const cache = await ctx.cache.get(itemUrl);
|
|
17
|
-
if (cache) {
|
|
18
|
-
return Promise.resolve(JSON.parse(cache));
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const res = await got.get(itemUrl);
|
|
22
|
-
const content = cheerio.load(res.data);
|
|
23
|
-
|
|
24
|
-
let description, pubDate;
|
|
25
|
-
|
|
26
|
-
if (content('div.news_video_msg').length > 0) {
|
|
27
|
-
description = content('#vdetail_sum').html();
|
|
28
|
-
pubDate = content('div.news_video_msg').html().split('  ')[0];
|
|
29
|
-
} else if (content('#slider_wrapper_ul').length > 0) {
|
|
30
|
-
description = '';
|
|
31
|
-
pubDate = new Date(date($(item).find('div.list_item_extra span').eq(1).text())).toUTCString();
|
|
32
|
-
} else {
|
|
33
|
-
description = content('div.newsdetail_content').html();
|
|
34
|
-
pubDate = new Date(content('div.date').text().trim().split('来源:')[0].trim() + ' GMT+8').toUTCString();
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const single = {
|
|
38
|
-
title: content('title').text(),
|
|
39
|
-
link: itemUrl,
|
|
40
|
-
description,
|
|
41
|
-
pubDate,
|
|
42
|
-
author: content('div.author').text(),
|
|
43
|
-
};
|
|
44
|
-
return Promise.resolve(single);
|
|
45
|
-
})
|
|
46
|
-
);
|
|
47
|
-
},
|
|
48
|
-
};
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
const got = require('@/utils/got');
|
|
2
|
-
const cheerio = require('cheerio');
|
|
3
|
-
const url = require('url');
|
|
4
|
-
const getCookie = require('../utils/pypasswaf');
|
|
5
|
-
const host = 'http://cs.nuaa.edu.cn/';
|
|
6
|
-
|
|
7
|
-
const map = new Map([
|
|
8
|
-
['tzgg', { title: '南京航空航天大学计算机科学与技术学院 -- 通知公告', suffix: '1995/list.htm' }],
|
|
9
|
-
['xwdt', { title: '南京航空航天大学计算机科学与技术学院 -- 新闻动态', suffix: '1997/list.htm' }],
|
|
10
|
-
['kydt', { title: '南京航空航天大学计算机科学与技术学院 -- 科研动态', suffix: '1975/list.htm' }],
|
|
11
|
-
['jxdt', { title: '南京航空航天大学计算机科学与技术学院 -- 教学动态', suffix: '1977/list.htm' }],
|
|
12
|
-
['xsgz', { title: '南京航空航天大学计算机科学与技术学院 -- 学生工作', suffix: '1959/list.htm' }],
|
|
13
|
-
['zsxx', { title: '南京航空航天大学计算机科学与技术学院 -- 招生信息', suffix: '1993/list.htm' }],
|
|
14
|
-
['jyxx', { title: '南京航空航天大学计算机科学与技术学院 -- 就业信息', suffix: '1994/list.htm' }],
|
|
15
|
-
]);
|
|
16
|
-
|
|
17
|
-
module.exports = async (ctx) => {
|
|
18
|
-
const type = ctx.params.type || 'tzgg';
|
|
19
|
-
const suffix = map.get(type).suffix;
|
|
20
|
-
|
|
21
|
-
const link = url.resolve(host, suffix);
|
|
22
|
-
const cookie = await getCookie();
|
|
23
|
-
const gotConfig = {
|
|
24
|
-
headers: {
|
|
25
|
-
cookie,
|
|
26
|
-
},
|
|
27
|
-
};
|
|
28
|
-
const response = await got.get(link, gotConfig);
|
|
29
|
-
const $ = cheerio.load(response.data);
|
|
30
|
-
|
|
31
|
-
const list = $('#news_list > ul > li')
|
|
32
|
-
.slice(0, 10)
|
|
33
|
-
.map(function () {
|
|
34
|
-
const info = {
|
|
35
|
-
title: $(this).find('a').attr('title'),
|
|
36
|
-
link: $(this).find('a').attr('href'),
|
|
37
|
-
date: $(this).find('span').text(),
|
|
38
|
-
};
|
|
39
|
-
return info;
|
|
40
|
-
})
|
|
41
|
-
.get();
|
|
42
|
-
|
|
43
|
-
const out = await Promise.all(
|
|
44
|
-
list.map(async (info) => {
|
|
45
|
-
const title = info.title || 'tzgg';
|
|
46
|
-
const date = info.date;
|
|
47
|
-
const itemUrl = url.resolve(host, info.link);
|
|
48
|
-
|
|
49
|
-
const cache = await ctx.cache.get(itemUrl);
|
|
50
|
-
if (cache) {
|
|
51
|
-
return Promise.resolve(JSON.parse(cache));
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const arr = itemUrl.split('.');
|
|
55
|
-
const pageType = arr[arr.length - 1];
|
|
56
|
-
|
|
57
|
-
let description = itemUrl;
|
|
58
|
-
if (pageType === 'htm' || pageType === 'html') {
|
|
59
|
-
const response = await got.get(itemUrl, gotConfig);
|
|
60
|
-
const $ = cheerio.load(response.data);
|
|
61
|
-
description = $('.wp_articlecontent')
|
|
62
|
-
.html()
|
|
63
|
-
.replace(/src="\//g, `src="${url.resolve(host, '.')}`)
|
|
64
|
-
.trim();
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const single = {
|
|
68
|
-
title,
|
|
69
|
-
link: itemUrl,
|
|
70
|
-
description,
|
|
71
|
-
pubDate: new Date(date).toUTCString(),
|
|
72
|
-
};
|
|
73
|
-
ctx.cache.set(itemUrl, JSON.stringify(single));
|
|
74
|
-
return Promise.resolve(single);
|
|
75
|
-
})
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
ctx.state.data = {
|
|
79
|
-
title: map.get(type).title,
|
|
80
|
-
link,
|
|
81
|
-
description: '南京航空航天大学计算机科学与技术学院RSS',
|
|
82
|
-
item: out,
|
|
83
|
-
};
|
|
84
|
-
};
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
const got = require('@/utils/got');
|
|
2
|
-
const cheerio = require('cheerio');
|
|
3
|
-
const url = require('url');
|
|
4
|
-
const host = 'http://aao.nuaa.edu.cn/';
|
|
5
|
-
// https is not allowed in nuaa;interesting ha
|
|
6
|
-
|
|
7
|
-
const map = {
|
|
8
|
-
default: 8230,
|
|
9
|
-
jxfw: 8230, // 教学服务
|
|
10
|
-
xspy: 8231, // 学生培养
|
|
11
|
-
jxjs: 8232, // 教学建设
|
|
12
|
-
jxzy: 8233, // 教学资源
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
async function load(link, cookie, ctx) {
|
|
16
|
-
const cache = await ctx.cache.get(link);
|
|
17
|
-
if (cache) {
|
|
18
|
-
return JSON.parse(cache);
|
|
19
|
-
}
|
|
20
|
-
const response = await got.get(link, {
|
|
21
|
-
headers: {
|
|
22
|
-
cookie,
|
|
23
|
-
},
|
|
24
|
-
});
|
|
25
|
-
const $ = cheerio.load(response.data);
|
|
26
|
-
const pubDate = new Date(
|
|
27
|
-
$('.release-time')
|
|
28
|
-
.text()
|
|
29
|
-
.slice(-10)
|
|
30
|
-
.match(/\d{4}-\d{2}-\d{2}/)
|
|
31
|
-
).toUTCString();
|
|
32
|
-
const images = $('img');
|
|
33
|
-
for (let k = 0; k < images.length; k++) {
|
|
34
|
-
$(images[k]).replaceWith(`<img src="${url.resolve(host, $(images[k]).attr('src'))}" />`);
|
|
35
|
-
}
|
|
36
|
-
const description = $('.wp_articlecontent').html();
|
|
37
|
-
const result = { pubDate, description };
|
|
38
|
-
ctx.cache.set(link, JSON.stringify(result));
|
|
39
|
-
|
|
40
|
-
return result;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
module.exports = async (ctx) => {
|
|
44
|
-
const browser = await require('@/utils/puppeteer')();
|
|
45
|
-
const type = ctx.params.type || 'default';
|
|
46
|
-
const listUrl = `${host}${map[type]}/list.htm`;
|
|
47
|
-
|
|
48
|
-
const page = await browser.newPage();
|
|
49
|
-
await page.setUserAgent('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36');
|
|
50
|
-
await page.evaluateOnNewDocument(() => {
|
|
51
|
-
// eslint-disable-next-line
|
|
52
|
-
Object.defineProperty(navigator, 'webdriver', { get: () => false });
|
|
53
|
-
});
|
|
54
|
-
// 南航的新waf现在采用cookie验证的方法防止爬虫,并且会对chrome headless进行检测
|
|
55
|
-
|
|
56
|
-
await page.goto(listUrl, {
|
|
57
|
-
waitUntil: 'networkidle0',
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
let msg;
|
|
61
|
-
try {
|
|
62
|
-
// data = await page.$('ul.right-ul')
|
|
63
|
-
msg = await page.$$eval('ul.right-ul > li', (es) =>
|
|
64
|
-
es.map((e) => {
|
|
65
|
-
const html = e.innerHTML;
|
|
66
|
-
|
|
67
|
-
let [, title] = html.match(/<a.+?>(.+)<\/a>/);
|
|
68
|
-
if (title.match(/font/)) {
|
|
69
|
-
[, title] = title.match(/>(.+)</);
|
|
70
|
-
}
|
|
71
|
-
const [, href] = html.match(/href="(.+?)"/);
|
|
72
|
-
// const [, time] = html.match(/-time">(.+?)</);
|
|
73
|
-
return {
|
|
74
|
-
title,
|
|
75
|
-
link: href,
|
|
76
|
-
guid: href,
|
|
77
|
-
};
|
|
78
|
-
})
|
|
79
|
-
);
|
|
80
|
-
} catch (e) {
|
|
81
|
-
// debugger
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
let cookie = await page.cookies();
|
|
85
|
-
cookie = cookie.map(({ name, value }) => `${name}=${value}`).join('; ');
|
|
86
|
-
browser.close();
|
|
87
|
-
msg = await Promise.all(
|
|
88
|
-
msg.map(async (e) => {
|
|
89
|
-
const link = url.resolve(host, e.link);
|
|
90
|
-
return {
|
|
91
|
-
...e,
|
|
92
|
-
link,
|
|
93
|
-
guid: link,
|
|
94
|
-
...(await load(link, cookie, ctx)),
|
|
95
|
-
};
|
|
96
|
-
})
|
|
97
|
-
);
|
|
98
|
-
|
|
99
|
-
ctx.state.data = {
|
|
100
|
-
title: '南航教务',
|
|
101
|
-
link: host,
|
|
102
|
-
description: '南航教务RSS',
|
|
103
|
-
item: msg,
|
|
104
|
-
};
|
|
105
|
-
};
|