rsshub 1.0.0-master.d2b1df9 → 1.0.0-master.d2bf7b3
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.js +3 -0
- package/lib/middleware/cache/index.js +3 -0
- package/lib/router.js +5 -5
- package/lib/v2/bangumi/maintainer.js +1 -0
- package/lib/v2/bangumi/online.js +26 -0
- package/lib/v2/bangumi/radar.js +13 -2
- package/lib/v2/bangumi/router.js +1 -0
- package/lib/v2/bangumi/templates/image.art +1 -0
- package/lib/v2/bilibili/collection.js +34 -0
- package/lib/v2/bilibili/maintainer.js +1 -0
- package/lib/v2/bilibili/radar.js +9 -0
- package/lib/v2/bilibili/router.js +1 -0
- package/lib/v2/china/maintainer.js +4 -0
- package/lib/v2/china/news/highlights/news.js +40 -0
- package/lib/v2/china/news/military/news.js +31 -0
- package/lib/v2/china/radar.js +21 -0
- package/lib/v2/china/router.js +4 -0
- package/lib/v2/csdn/blog.js +39 -0
- package/lib/v2/csdn/maintainer.js +3 -0
- package/lib/v2/csdn/radar.js +13 -0
- package/lib/v2/csdn/router.js +3 -0
- package/lib/v2/douyu/post.js +9 -2
- package/lib/v2/github/comments.js +3 -4
- package/lib/v2/hupu/bbs.js +23 -23
- package/lib/v2/huxiu/maintainer.js +1 -0
- package/lib/v2/huxiu/moment.js +40 -0
- package/lib/v2/huxiu/radar.js +6 -0
- package/lib/v2/huxiu/router.js +1 -0
- package/lib/v2/huxiu/templates/moment.art +16 -0
- package/lib/v2/iwara/maintainer.js +1 -0
- package/lib/v2/iwara/radar.js +6 -0
- package/lib/v2/iwara/router.js +1 -0
- package/lib/v2/iwara/subscriptions.js +49 -0
- package/lib/v2/iwara/templates/subscriptions.art +1 -0
- package/lib/v2/leetcode/dailyquestion-solution-cn.js +183 -0
- package/lib/v2/leetcode/dailyquestion-solution-en.js +213 -0
- package/lib/v2/leetcode/maintainer.js +1 -0
- package/lib/v2/leetcode/radar.js +12 -0
- package/lib/v2/leetcode/router.js +2 -0
- package/lib/v2/lovelive-anime/maintainer.js +3 -0
- package/lib/v2/lovelive-anime/news.js +56 -0
- package/lib/v2/lovelive-anime/radar.js +13 -0
- package/lib/v2/lovelive-anime/router.js +3 -0
- package/lib/v2/lovelive-anime/templates/description.art +1 -0
- package/lib/v2/macfilos/blog.js +61 -0
- package/lib/v2/macfilos/maintainer.js +3 -0
- package/lib/v2/macfilos/radar.js +13 -0
- package/lib/v2/macfilos/router.js +3 -0
- package/lib/v2/meteor/boards.js +11 -0
- package/lib/v2/meteor/index.js +45 -0
- package/lib/v2/meteor/maintainer.js +4 -0
- package/lib/v2/meteor/radar.js +19 -0
- package/lib/v2/meteor/router.js +4 -0
- package/lib/v2/meteor/templates/desc.art +7 -0
- package/lib/v2/meteor/utils.js +90 -0
- package/lib/v2/nikkei-cn/index.js +4 -1
- package/lib/v2/nua/gra.js +56 -0
- package/lib/v2/nua/maintainer.js +3 -0
- package/lib/v2/nua/radar.js +13 -0
- package/lib/v2/nua/router.js +3 -0
- package/lib/v2/oschina/maintainer.js +6 -0
- package/lib/{routes → v2}/oschina/news.js +35 -39
- package/lib/v2/oschina/radar.js +33 -0
- package/lib/v2/oschina/router.js +6 -0
- package/lib/v2/oschina/topic.js +53 -0
- package/lib/v2/oschina/user.js +50 -0
- package/lib/v2/plurk/anonymous.js +23 -0
- package/lib/v2/plurk/hotlinks.js +20 -0
- package/lib/v2/plurk/maintainer.js +9 -0
- package/lib/v2/plurk/news.js +23 -0
- package/lib/v2/plurk/radar.js +56 -0
- package/lib/v2/plurk/router.js +9 -0
- package/lib/v2/plurk/search.js +27 -0
- package/lib/v2/plurk/top.js +29 -0
- package/lib/v2/plurk/topic.js +33 -0
- package/lib/v2/plurk/user.js +31 -0
- package/lib/v2/plurk/utils.js +56 -0
- package/lib/v2/segmentfault/blogs.js +38 -0
- package/lib/v2/segmentfault/maintainer.js +1 -0
- package/lib/v2/segmentfault/radar.js +8 -2
- package/lib/v2/segmentfault/router.js +1 -0
- package/lib/v2/sensortower/blog.js +69 -0
- package/lib/v2/sensortower/maintainer.js +3 -0
- package/lib/v2/sensortower/radar.js +13 -0
- package/lib/v2/sensortower/router.js +3 -0
- package/lib/v2/sensortower/templates/description.art +9 -0
- package/lib/v2/taptap/templates/imagePost.art +3 -0
- package/lib/v2/taptap/templates/videoPost.art +2 -1
- package/lib/v2/taptap/topic.js +33 -27
- package/lib/v2/taptap/utils.js +13 -8
- package/lib/v2/test/index.js +15 -0
- package/lib/v2/trending/allTrending.js +46 -19
- package/lib/v2/trending/templates/content.art +1 -0
- package/lib/v2/twitter/maintainer.js +1 -1
- package/lib/v2/twitter/router.js +1 -1
- package/lib/v2/twitter/web-api/twitter-api.js +1 -0
- package/lib/v2/warthunder/maintainer.js +3 -0
- package/lib/v2/warthunder/news.js +49 -0
- package/lib/v2/warthunder/radar.js +13 -0
- package/lib/v2/warthunder/router.js +3 -0
- package/lib/v2/warthunder/templates/description.art +1 -0
- package/lib/v2/xyzrank/index.js +111 -0
- package/lib/v2/xyzrank/maintainer.js +6 -0
- package/lib/v2/xyzrank/radar.js +31 -0
- package/lib/v2/xyzrank/router.js +3 -0
- package/lib/v2/xyzrank/templates/description.art +12 -0
- package/lib/v2/zaobao/util.js +6 -6
- package/lib/v2/zuvio/boards.js +14 -0
- package/lib/v2/zuvio/radar.js +13 -0
- package/lib/v2/zuvio/router.js +4 -0
- package/lib/v2/zuvio/student5.js +58 -0
- package/lib/v2/zuvio/templates/img.art +2 -0
- package/lib/v2/zuvio/templates/link.art +7 -0
- package/lib/v2/zuvio/templates/ref_article.art +8 -0
- package/lib/v2/zuvio/templates/rss.art +1 -0
- package/lib/v2/zuvio/templates/youtube.art +2 -0
- package/lib/v2/zuvio/utils.js +61 -0
- package/package.json +14 -15
- package/lib/routes/oschina/topic.js +0 -54
- package/lib/routes/oschina/u.js +0 -57
- package/lib/routes/oschina/user.js +0 -57
- package/lib/v2/hupu/templates/description.art +0 -6
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
const cheerio = require('cheerio');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const { art } = require('@/utils/render');
|
|
5
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
6
|
+
const timezone = require('@/utils/timezone');
|
|
7
|
+
const renderDescription = (desc) => art(path.join(__dirname, 'templates/description.art'), desc);
|
|
8
|
+
|
|
9
|
+
module.exports = async (ctx) => {
|
|
10
|
+
const rootUrl = 'https://warthunder.com/en/news/';
|
|
11
|
+
|
|
12
|
+
const response = await got(rootUrl);
|
|
13
|
+
|
|
14
|
+
const $ = cheerio.load(response.data);
|
|
15
|
+
|
|
16
|
+
const pageFace = $('div.showcase__item.widget')
|
|
17
|
+
.map((_, item) => {
|
|
18
|
+
item = $(item);
|
|
19
|
+
let pubDate = parseDate(item.find('div.widget__content > ul > li').text(), 'D MMMM YYYY');
|
|
20
|
+
pubDate = timezone(pubDate, 0);
|
|
21
|
+
const category = [];
|
|
22
|
+
if (item.find('div.widget__pin').length !== 0) {
|
|
23
|
+
category.push('pinned');
|
|
24
|
+
}
|
|
25
|
+
if (item.find('a.widget__decal').length !== 0) {
|
|
26
|
+
category.push('decal');
|
|
27
|
+
}
|
|
28
|
+
if (item.find('div.widget__badge').length !== 0) {
|
|
29
|
+
category.push(item.find('div.widget__badge').text());
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
link: `https://warthunder.com${item.find('a.widget__link').attr('href')}`,
|
|
33
|
+
title: item.find('div.widget__content > div.widget__title').text(),
|
|
34
|
+
pubDate,
|
|
35
|
+
description: renderDescription({
|
|
36
|
+
description: item.find('div.widget__content > div.widget__comment').text(),
|
|
37
|
+
imglink: item.find('div.widget__poster > img.widget__poster-media').attr('data-src'),
|
|
38
|
+
}),
|
|
39
|
+
category,
|
|
40
|
+
};
|
|
41
|
+
})
|
|
42
|
+
.get();
|
|
43
|
+
|
|
44
|
+
ctx.state.data = {
|
|
45
|
+
title: 'War Thunder News',
|
|
46
|
+
link: 'https://warthunder.com/en/news/',
|
|
47
|
+
item: pageFace,
|
|
48
|
+
};
|
|
49
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{{description}}<br><img src="https:{{imglink}}">
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
const cheerio = require('cheerio');
|
|
3
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
4
|
+
const { art } = require('@/utils/render');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
|
|
7
|
+
module.exports = async (ctx) => {
|
|
8
|
+
const category = ctx.params.category ?? '';
|
|
9
|
+
|
|
10
|
+
const rootUrl = 'https://xyzrank.com';
|
|
11
|
+
const currentUrl = `${rootUrl}/#/${category}`;
|
|
12
|
+
|
|
13
|
+
let response = await got({
|
|
14
|
+
method: 'get',
|
|
15
|
+
url: rootUrl,
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const $ = cheerio.load(response.data);
|
|
19
|
+
|
|
20
|
+
response = await got({
|
|
21
|
+
method: 'get',
|
|
22
|
+
url: response.data.match(/<script type="module" crossorigin src="(.*?)"><\/script>/)[1],
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const matches = response.data.match(/pI="(.*?)",gI="(.*?)",mI="(.*?)",_I="(.*?)";var/);
|
|
26
|
+
|
|
27
|
+
const categories = {
|
|
28
|
+
'': {
|
|
29
|
+
url: matches[3],
|
|
30
|
+
title: '热门节目',
|
|
31
|
+
id: 'hot-episodes',
|
|
32
|
+
type: 'episodes',
|
|
33
|
+
},
|
|
34
|
+
'hot-podcasts': {
|
|
35
|
+
url: matches[1],
|
|
36
|
+
title: '热门播客',
|
|
37
|
+
id: 'full',
|
|
38
|
+
type: 'podcasts',
|
|
39
|
+
},
|
|
40
|
+
'hot-episodes-new': {
|
|
41
|
+
url: matches[4],
|
|
42
|
+
title: '新锐节目',
|
|
43
|
+
id: 'hot-episodes-new',
|
|
44
|
+
type: 'episodes',
|
|
45
|
+
},
|
|
46
|
+
'new-podcasts': {
|
|
47
|
+
url: matches[2],
|
|
48
|
+
title: '新锐播客',
|
|
49
|
+
id: 'new-podcasts',
|
|
50
|
+
type: 'podcasts',
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
response = await got({
|
|
55
|
+
method: 'get',
|
|
56
|
+
url: categories[category].url,
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const type = categories[category].type;
|
|
60
|
+
|
|
61
|
+
const items = response.data.data[type].slice(0, ctx.query.limit ? parseInt(ctx.query.limit) : 250).map((item, index) => ({
|
|
62
|
+
title: `#${index + 1} ${item.title ?? item.name}`,
|
|
63
|
+
category: [item.primaryGenreName],
|
|
64
|
+
author: item.authorsText,
|
|
65
|
+
link: `${item.link ?? item.links[0].url}${item.trackCount ? `#${item.trackCount}` : ''}`,
|
|
66
|
+
pubDate: parseDate(item.postTime ?? item.lastReleaseDate),
|
|
67
|
+
description: art(path.join(__dirname, 'templates/description.art'), {
|
|
68
|
+
logo: item.logoURL,
|
|
69
|
+
items:
|
|
70
|
+
type === 'podcasts'
|
|
71
|
+
? {
|
|
72
|
+
'#': index + 1,
|
|
73
|
+
播客电台: item.name,
|
|
74
|
+
主持: item.authorsText,
|
|
75
|
+
分类: item.primaryGenreName,
|
|
76
|
+
更新频率: `${(item.avgUpdateFreq / 24).toFixed(1)}天`,
|
|
77
|
+
最近更新: `${item.lastReleaseDateDayCount.toFixed(1)}天前`,
|
|
78
|
+
总集数: item.trackCount,
|
|
79
|
+
平均时长: `${item.avgDuration}′`,
|
|
80
|
+
平均播放量: item.avgPlayCount,
|
|
81
|
+
平均评论量: item.avgCommentCount,
|
|
82
|
+
千播互动量: (item.avgInteractIndicator * 1000).toFixed(0),
|
|
83
|
+
平均打开率: `${(item.avgOpenRate * 100).toFixed(1)}%`,
|
|
84
|
+
小宇宙: item.links[0].url,
|
|
85
|
+
'Apple Podcasts': item.links[1].url,
|
|
86
|
+
官方网站: item.links[2].url,
|
|
87
|
+
'RSS 订阅': item.links[3].url,
|
|
88
|
+
}
|
|
89
|
+
: {
|
|
90
|
+
'#': index + 1,
|
|
91
|
+
节目标题: item.title,
|
|
92
|
+
播客电台: item.podcastName,
|
|
93
|
+
播放量: item.playCount,
|
|
94
|
+
评论量: item.commentCount,
|
|
95
|
+
互动率: `${((item.commentCount / item.playCount) * 100).toFixed(1)}%`,
|
|
96
|
+
打开率: `${(item.openRate * 100).toFixed(1)}%`,
|
|
97
|
+
时长: `${item.duration}′`,
|
|
98
|
+
发布时间: item.postTime,
|
|
99
|
+
分类: item.primaryGenreName,
|
|
100
|
+
链接: item.link,
|
|
101
|
+
},
|
|
102
|
+
}),
|
|
103
|
+
}));
|
|
104
|
+
|
|
105
|
+
ctx.state.data = {
|
|
106
|
+
title: `${$('title').text()} - ${categories[category].title}`,
|
|
107
|
+
link: currentUrl,
|
|
108
|
+
item: items,
|
|
109
|
+
description: $('meta[property="og:description"]').attr('content'),
|
|
110
|
+
};
|
|
111
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
'xyzrank.com': {
|
|
3
|
+
_name: '中文播客榜',
|
|
4
|
+
'.': [
|
|
5
|
+
{
|
|
6
|
+
title: '热门节目',
|
|
7
|
+
docs: 'https://docs.rsshub.app/multimedia.html#zhong-wen-bo-ke-bang-re-men-jie-mu',
|
|
8
|
+
source: ['/#/', '/'],
|
|
9
|
+
target: '/xyzrank',
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
title: '热门播客',
|
|
13
|
+
docs: 'https://docs.rsshub.app/multimedia.html#zhong-wen-bo-ke-bang-re-men-bo-ke',
|
|
14
|
+
source: ['/#/hot-podcasts', '/'],
|
|
15
|
+
target: '/xyzrank/hot-podcasts',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
title: '新锐节目',
|
|
19
|
+
docs: 'https://docs.rsshub.app/multimedia.html#zhong-wen-bo-ke-bang-xin-rui-jie-mu',
|
|
20
|
+
source: ['/#/hot-episodes-new', '/'],
|
|
21
|
+
target: '/xyzrank/hot-episodes-new',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
title: '新锐播客',
|
|
25
|
+
docs: 'https://docs.rsshub.app/multimedia.html#zhong-wen-bo-ke-bang-xin-rui-bo-ke',
|
|
26
|
+
source: ['/#/new-podcasts', '/'],
|
|
27
|
+
target: '/xyzrank/new-podcasts',
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
};
|
package/lib/v2/zaobao/util.js
CHANGED
|
@@ -132,23 +132,23 @@ const parseList = async (ctx, sectionUrl) => {
|
|
|
132
132
|
});
|
|
133
133
|
}
|
|
134
134
|
if ($1('.inline-figure-gallery').length) {
|
|
135
|
-
//
|
|
135
|
+
// for SG version
|
|
136
136
|
imageDataArray.push({
|
|
137
137
|
type: 'normalHTML',
|
|
138
138
|
html: $1('.inline-figure-gallery')
|
|
139
139
|
.html()
|
|
140
|
-
.replace(/\/\/.*\.com\/s3fs-public
|
|
141
|
-
.replace(/s3\/files
|
|
140
|
+
.replace(/\/\/.*\.com\/s3fs-public/g, '//static.zaobao.com/s3fs-public')
|
|
141
|
+
.replace(/s3\/files/g, 's3fs-public'),
|
|
142
142
|
});
|
|
143
143
|
}
|
|
144
144
|
if ($1('#carousel-article').length) {
|
|
145
|
-
// for HK version
|
|
145
|
+
// for HK version, HK version of multi images use same selector as single image, so g is needed for all pages
|
|
146
146
|
imageDataArray.push({
|
|
147
147
|
type: 'normalHTML',
|
|
148
148
|
html: $1('#carousel-article .carousel-inner')
|
|
149
149
|
.html()
|
|
150
|
-
.replace(/\/\/.*\.com\/s3fs-public
|
|
151
|
-
.replace(/s3\/files
|
|
150
|
+
.replace(/\/\/.*\.com\/s3fs-public/g, '//static.zaobao.com/s3fs-public')
|
|
151
|
+
.replace(/s3\/files/g, 's3fs-public'),
|
|
152
152
|
});
|
|
153
153
|
}
|
|
154
154
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const { getBoards, rootUrl } = require('./utils');
|
|
2
|
+
|
|
3
|
+
module.exports = async (ctx) => {
|
|
4
|
+
const items = await getBoards(ctx.cache.tryGet);
|
|
5
|
+
|
|
6
|
+
ctx.state.data = {
|
|
7
|
+
title: 'Zuvio 校園話題列表 - 大學生論壇',
|
|
8
|
+
description: 'Zuvio 校園話題,Zuvio 校園話題千種動物頭像交流心得。最萌的匿名論壇,上千種逗趣動物頭像隨你變換,點頭像立即私訊功能,讓你找到共同話題的小夥伴!多人分享配對心得、聊天交友心情在此,快加入17分享!',
|
|
9
|
+
image: 'https://s3.hicloud.net.tw/zuvio.public/public/system/images/irs_v4/chicken/shared/webshare.png',
|
|
10
|
+
link: `${rootUrl}/articles`,
|
|
11
|
+
item: items,
|
|
12
|
+
language: 'zh-Hant',
|
|
13
|
+
};
|
|
14
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
'zuvio.com.tw': {
|
|
3
|
+
_name: 'Zuvio',
|
|
4
|
+
irs: [
|
|
5
|
+
{
|
|
6
|
+
title: '校園話題',
|
|
7
|
+
docs: 'https://docs.rsshub.app/bbs.html#zuvio',
|
|
8
|
+
source: ['/student5/chickenM/articles/:board', '/student5/chickenM/articles'],
|
|
9
|
+
target: (params) => `/zuvio/student5${params.board ? `/${params.board}` : ''}`,
|
|
10
|
+
},
|
|
11
|
+
],
|
|
12
|
+
},
|
|
13
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
3
|
+
const timezone = require('@/utils/timezone');
|
|
4
|
+
const { token, apiUrl, rootUrl, renderDesc, getBoards } = require('./utils');
|
|
5
|
+
|
|
6
|
+
module.exports = async (ctx) => {
|
|
7
|
+
const { board = '' } = ctx.params;
|
|
8
|
+
const title = board ? (await getBoards(ctx.cache.tryGet)).find((i) => i.boardId === board).title : '全部';
|
|
9
|
+
|
|
10
|
+
const { data } = await got(`${apiUrl}/article`, {
|
|
11
|
+
searchParams: {
|
|
12
|
+
api_token: token,
|
|
13
|
+
user_id: '0',
|
|
14
|
+
board_id: board,
|
|
15
|
+
sort: 'time',
|
|
16
|
+
page: '1',
|
|
17
|
+
device: 'web',
|
|
18
|
+
my_school_opinion: '1',
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const items = data.articles.map((item) => ({
|
|
23
|
+
title: item.title,
|
|
24
|
+
description: item.abstract,
|
|
25
|
+
pubDate: timezone(parseDate(item.created_at), +8),
|
|
26
|
+
link: `${rootUrl}/article/${item.id}`,
|
|
27
|
+
api: `${apiUrl}/article/${item.id}`,
|
|
28
|
+
author: `${item.university} ${item.user_name}`,
|
|
29
|
+
category: item.board_name,
|
|
30
|
+
}));
|
|
31
|
+
|
|
32
|
+
await Promise.all(
|
|
33
|
+
items.map((item) =>
|
|
34
|
+
ctx.cache.tryGet(item.link, async () => {
|
|
35
|
+
const { data } = await got(item.api, {
|
|
36
|
+
searchParams: {
|
|
37
|
+
api_token: token,
|
|
38
|
+
user_id: '0',
|
|
39
|
+
device: 'web',
|
|
40
|
+
ref: '',
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
item.description = renderDesc(data);
|
|
44
|
+
delete item.api;
|
|
45
|
+
return item;
|
|
46
|
+
})
|
|
47
|
+
)
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
ctx.state.data = {
|
|
51
|
+
title: `Zuvio 校園${title}話題 - 大學生論壇`,
|
|
52
|
+
description: 'Zuvio 校園話題千種動物頭像交流心得。最萌的匿名論壇,上千種逗趣動物頭像隨你變換,點頭像立即私訊功能,讓你找到共同話題的小夥伴!多人分享配對心得、聊天交友心情在此,快加入17分享!',
|
|
53
|
+
image: 'https://s3.hicloud.net.tw/zuvio.public/public/system/images/irs_v4/chicken/shared/webshare.png',
|
|
54
|
+
link: `${rootUrl}/articles`,
|
|
55
|
+
item: items,
|
|
56
|
+
language: 'zh-Hant',
|
|
57
|
+
};
|
|
58
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
引用自:
|
|
2
|
+
<a href="{{ ref_article.id }}">
|
|
3
|
+
<img src="{{ ref_article.user_icon }}">
|
|
4
|
+
<div>{{ ref_article.university }} {{ ref_article.user_name }} {{ ref_article.board_name }}</div>
|
|
5
|
+
<div>{{ ref_article.title }}</div>
|
|
6
|
+
<div>{{ ref_article.abstract }}</div>
|
|
7
|
+
</a>
|
|
8
|
+
<hr>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<a href="https://rsshub.app/zuvio/student5/{{ id }}">{{ id }}</a>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
const { art } = require('@/utils/render');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const got = require('@/utils/got');
|
|
4
|
+
|
|
5
|
+
const token =
|
|
6
|
+
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE0OTcyMzI1MjMsInN5c3RlbV9uYW1lIjoiZm9ydW0iLCJ6dXZpb19pZCI6LTk5OSwiZW1haWwiOm51bGwsIm5hbWUiOm51bGwsInVuaXZlcnNpdHlfaWQiOm51bGwsInVuaXZlcnNpdHlfbmFtZSI6bnVsbH0.0KoJiSnyazsJxLCNEnqnuNUdKsJFhBdCn3R2BJpoUtk';
|
|
7
|
+
const apiUrl = 'https://forum.zuvio.com.tw/api';
|
|
8
|
+
const rootUrl = 'https://irs.zuvio.com.tw/student5/chickenM';
|
|
9
|
+
|
|
10
|
+
const renderDesc = (data) => {
|
|
11
|
+
let output = '';
|
|
12
|
+
if (data.ref_article) {
|
|
13
|
+
output += art(path.join(__dirname, 'templates/ref_article.art'), {
|
|
14
|
+
ref_article: data.ref_article,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
output += renderSections(data.sections);
|
|
18
|
+
return output;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const renderSections = (sections) => {
|
|
22
|
+
let output = '';
|
|
23
|
+
for (const section of sections) {
|
|
24
|
+
if (section.type === 'text') {
|
|
25
|
+
output += section.content.replace(/\n/g, '<br>');
|
|
26
|
+
} else if (section.type === 'img') {
|
|
27
|
+
output += art(path.join(__dirname, 'templates/img.art'), { section });
|
|
28
|
+
} else if (section.type === 'youtube') {
|
|
29
|
+
output += art(path.join(__dirname, 'templates/youtube.art'), { section });
|
|
30
|
+
} else if (section.type === 'link') {
|
|
31
|
+
output += art(path.join(__dirname, 'templates/link.art'), { section });
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return output;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const getBoards = (tryGet) =>
|
|
38
|
+
tryGet('zuvio:boards', async () => {
|
|
39
|
+
const { data } = await got(`${apiUrl}/board`, {
|
|
40
|
+
searchParams: {
|
|
41
|
+
api_token: token,
|
|
42
|
+
user_id: '0',
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
return data.map((item) => ({
|
|
47
|
+
title: item.name,
|
|
48
|
+
description: art(path.join(__dirname, 'templates/rss.art'), { id: item.id }),
|
|
49
|
+
boardId: item.id,
|
|
50
|
+
link: `${rootUrl}/articles/${item.id}`,
|
|
51
|
+
}));
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
module.exports = {
|
|
55
|
+
token,
|
|
56
|
+
apiUrl,
|
|
57
|
+
rootUrl,
|
|
58
|
+
renderDesc,
|
|
59
|
+
renderSections,
|
|
60
|
+
getBoards,
|
|
61
|
+
};
|
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.d2bf7b3",
|
|
4
4
|
"description": "Make RSS Great Again!",
|
|
5
5
|
"main": "lib/pkg.js",
|
|
6
6
|
"files": [
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@vuepress/plugin-pwa": "1.9.7",
|
|
50
50
|
"@vuepress/shared-utils": "1.9.7",
|
|
51
51
|
"cross-env": "7.0.3",
|
|
52
|
-
"eslint": "8.
|
|
52
|
+
"eslint": "8.22.0",
|
|
53
53
|
"eslint-config-prettier": "8.5.0",
|
|
54
54
|
"eslint-plugin-prettier": "4.2.1",
|
|
55
55
|
"eslint-plugin-yml": "1.1.0",
|
|
@@ -79,12 +79,12 @@
|
|
|
79
79
|
"dependencies": {
|
|
80
80
|
"@koa/router": "12.0.0",
|
|
81
81
|
"@postlight/mercury-parser": "2.2.1",
|
|
82
|
-
"@sentry/node": "7.
|
|
82
|
+
"@sentry/node": "7.11.1",
|
|
83
83
|
"aes-js": "3.1.2",
|
|
84
84
|
"art-template": "4.13.2",
|
|
85
85
|
"bbcodejs": "0.0.4",
|
|
86
86
|
"cheerio": "1.0.0-rc.12",
|
|
87
|
-
"chrono-node": "2.
|
|
87
|
+
"chrono-node": "2.4.1",
|
|
88
88
|
"city-timezones": "1.2.1",
|
|
89
89
|
"crypto-js": "4.1.1",
|
|
90
90
|
"currency-symbol-map": "5.1.0",
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"etag": "1.8.1",
|
|
96
96
|
"fanfou-sdk": "4.2.0",
|
|
97
97
|
"git-rev-sync": "3.0.2",
|
|
98
|
-
"googleapis": "
|
|
98
|
+
"googleapis": "107.0.0",
|
|
99
99
|
"got": "11.8.5",
|
|
100
100
|
"https-proxy-agent": "5.0.1",
|
|
101
101
|
"iconv-lite": "0.6.3",
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"koa-basic-auth": "4.0.0",
|
|
111
111
|
"koa-favicon": "2.1.0",
|
|
112
112
|
"koa-mount": "4.0.0",
|
|
113
|
-
"lru-cache": "7.
|
|
113
|
+
"lru-cache": "7.14.0",
|
|
114
114
|
"lz-string": "1.4.4",
|
|
115
115
|
"mailparser": "3.5.0",
|
|
116
116
|
"markdown-it": "13.0.1",
|
|
@@ -118,11 +118,11 @@
|
|
|
118
118
|
"parse-torrent": "9.1.5",
|
|
119
119
|
"pidusage": "3.0.0",
|
|
120
120
|
"plist": "3.0.6",
|
|
121
|
-
"puppeteer": "16.
|
|
121
|
+
"puppeteer": "16.2.0",
|
|
122
122
|
"puppeteer-extra": "3.3.4",
|
|
123
123
|
"puppeteer-extra-plugin-stealth": "2.11.1",
|
|
124
124
|
"query-string": "7.1.1",
|
|
125
|
-
"rand-user-agent": "1.0.
|
|
125
|
+
"rand-user-agent": "1.0.78",
|
|
126
126
|
"re2": "1.17.7",
|
|
127
127
|
"require-all": "3.0.0",
|
|
128
128
|
"rss-parser": "3.12.0",
|
|
@@ -132,9 +132,9 @@
|
|
|
132
132
|
"string-similarity": "4.0.4",
|
|
133
133
|
"tiny-async-pool": "2.1.0",
|
|
134
134
|
"torrent-search-api": "2.1.4",
|
|
135
|
-
"tough-cookie": "4.
|
|
135
|
+
"tough-cookie": "4.1.0",
|
|
136
136
|
"tunnel": "0.0.6",
|
|
137
|
-
"twitter-api-v2": "1.12.
|
|
137
|
+
"twitter-api-v2": "1.12.5",
|
|
138
138
|
"winston": "3.8.1",
|
|
139
139
|
"xml2js": "0.4.23"
|
|
140
140
|
},
|
|
@@ -166,11 +166,10 @@
|
|
|
166
166
|
"nodemonConfig": {
|
|
167
167
|
"watch": [
|
|
168
168
|
".env",
|
|
169
|
-
"
|
|
170
|
-
"
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
]
|
|
169
|
+
"lib",
|
|
170
|
+
"test"
|
|
171
|
+
],
|
|
172
|
+
"ext": "art,js,mjs,json"
|
|
174
173
|
},
|
|
175
174
|
"engines": {
|
|
176
175
|
"node": ">=14"
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
const url = require('url');
|
|
2
|
-
const got = require('@/utils/got');
|
|
3
|
-
const date = require('@/utils/date');
|
|
4
|
-
const cheerio = require('cheerio');
|
|
5
|
-
|
|
6
|
-
async function load(link) {
|
|
7
|
-
const res = await got({
|
|
8
|
-
method: 'get',
|
|
9
|
-
url: link,
|
|
10
|
-
});
|
|
11
|
-
const content = cheerio.load(res.data);
|
|
12
|
-
content('.ad-wrap').remove();
|
|
13
|
-
return content;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
module.exports = async (ctx) => {
|
|
17
|
-
const topic = ctx.params.topic;
|
|
18
|
-
const topicUrl = `https://www.oschina.net/question/topic/${topic}?show=time`;
|
|
19
|
-
|
|
20
|
-
const $ = await load(topicUrl);
|
|
21
|
-
const topicName = $('.topic-info > .topic-header > h3').text();
|
|
22
|
-
const list = $('#questionList').find('.question-item');
|
|
23
|
-
const count = [];
|
|
24
|
-
for (let i = 0; i < Math.min(list.length, 10); i++) {
|
|
25
|
-
count.push(i);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const resultItem = await Promise.all(
|
|
29
|
-
count.map(async (i) => {
|
|
30
|
-
const each = $(list[i]);
|
|
31
|
-
const originalUrl = each.find('.header').attr('href');
|
|
32
|
-
|
|
33
|
-
const item = {
|
|
34
|
-
title: each.find('.header').text(),
|
|
35
|
-
link: url.resolve('https://www.oschina.net', encodeURI(originalUrl)),
|
|
36
|
-
author: date(each.find('.extra > .list > .item:nth-of-type(1)').text()),
|
|
37
|
-
pubDate: date(each.find('.extra > .list > .item:nth-of-type(2)').text()),
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
item.description = await ctx.cache.tryGet(originalUrl, async () => {
|
|
41
|
-
const content = await load(item.link);
|
|
42
|
-
return content('#articleContent').html();
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
return item;
|
|
46
|
-
})
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
ctx.state.data = {
|
|
50
|
-
title: `开源中国-${topicName}`,
|
|
51
|
-
link: topicUrl,
|
|
52
|
-
item: resultItem,
|
|
53
|
-
};
|
|
54
|
-
};
|
package/lib/routes/oschina/u.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
const got = require('@/utils/got');
|
|
2
|
-
const cheerio = require('cheerio');
|
|
3
|
-
|
|
4
|
-
module.exports = async (ctx) => {
|
|
5
|
-
const id = ctx.params.id;
|
|
6
|
-
const res = await got({
|
|
7
|
-
method: 'get',
|
|
8
|
-
url: `https://my.oschina.net/u/${id}`,
|
|
9
|
-
headers: {
|
|
10
|
-
Referer: `https://my.oschina.net/u/${id}`,
|
|
11
|
-
},
|
|
12
|
-
});
|
|
13
|
-
const $ = cheerio.load(res.data);
|
|
14
|
-
$('div[data-tooltip]').remove();
|
|
15
|
-
const author = $('[data-user-name]').attr('data-user-name');
|
|
16
|
-
const list = $('#newestBlogList').find('.blog-item');
|
|
17
|
-
const count = [];
|
|
18
|
-
for (let i = 0; i < Math.min(list.length, 10); i++) {
|
|
19
|
-
count.push(i);
|
|
20
|
-
}
|
|
21
|
-
const resultItem = await Promise.all(
|
|
22
|
-
count.map(async (i) => {
|
|
23
|
-
const each = $(list[i]);
|
|
24
|
-
const originalUrl = each.find('a.header', '.content').attr('href');
|
|
25
|
-
const item = {
|
|
26
|
-
title: each.find('a.header', '.content').text(),
|
|
27
|
-
description: each.find('p', '.description').text(),
|
|
28
|
-
link: encodeURI(originalUrl),
|
|
29
|
-
};
|
|
30
|
-
const key = 'oschina' + item.link;
|
|
31
|
-
const value = await ctx.cache.get(key);
|
|
32
|
-
|
|
33
|
-
if (value) {
|
|
34
|
-
item.description = value;
|
|
35
|
-
} else {
|
|
36
|
-
const detail = await got({
|
|
37
|
-
method: 'get',
|
|
38
|
-
url: item.link,
|
|
39
|
-
headers: {
|
|
40
|
-
Referer: item.link,
|
|
41
|
-
},
|
|
42
|
-
});
|
|
43
|
-
const content = cheerio.load(detail.data);
|
|
44
|
-
content('#articleContent .ad-wrap').remove();
|
|
45
|
-
item.description = content('.article-detail').html();
|
|
46
|
-
ctx.cache.set(key, item.description);
|
|
47
|
-
}
|
|
48
|
-
return item;
|
|
49
|
-
})
|
|
50
|
-
);
|
|
51
|
-
|
|
52
|
-
ctx.state.data = {
|
|
53
|
-
title: author + '的博客',
|
|
54
|
-
link: `https://my.oschina.net/u/${id}`,
|
|
55
|
-
item: resultItem,
|
|
56
|
-
};
|
|
57
|
-
};
|