rsshub 1.0.0-master.d3ce31d → 1.0.0-master.d4c8fa0
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/middleware/parameter.js +10 -4
- package/lib/radar-rules.js +20 -37
- package/lib/router.js +9 -9
- package/lib/v2/36kr/index.js +75 -0
- package/lib/v2/36kr/maintainer.js +7 -5
- package/lib/v2/36kr/radar.js +27 -15
- package/lib/v2/36kr/router.js +1 -5
- package/lib/v2/acs/journal.js +73 -0
- package/lib/v2/acs/maintainer.js +3 -0
- package/lib/v2/acs/radar.js +13 -0
- package/lib/v2/acs/router.js +3 -0
- package/lib/v2/acs/templates/description.art +2 -0
- package/lib/v2/airchina/index.js +36 -0
- package/lib/v2/airchina/maintainer.js +3 -0
- package/lib/v2/airchina/radar.js +13 -0
- package/lib/v2/airchina/router.js +3 -0
- package/lib/v2/allrecode/index.js +65 -0
- package/lib/v2/allrecode/maintainer.js +5 -0
- package/lib/v2/allrecode/news.js +35 -0
- package/lib/v2/allrecode/radar.js +25 -0
- package/lib/v2/allrecode/router.js +4 -0
- package/lib/v2/biquge/index.js +78 -0
- package/lib/v2/biquge/maintainer.js +3 -0
- package/lib/v2/biquge/radar.js +29 -0
- package/lib/v2/biquge/router.js +3 -0
- package/lib/v2/ccfcv/index.js +68 -0
- package/lib/v2/ccfcv/maintainer.js +3 -0
- package/lib/v2/ccfcv/radar.js +25 -0
- package/lib/v2/ccfcv/router.js +3 -0
- package/lib/v2/ccfcv/templates/description.art +1 -0
- package/lib/v2/cde/maintainer.js +1 -0
- package/lib/v2/cde/radar.js +12 -0
- package/lib/v2/cde/router.js +1 -0
- package/lib/v2/cde/zdyz.js +77 -0
- package/lib/v2/clash/maintainer.js +3 -0
- package/lib/v2/clash/premium.js +23 -0
- package/lib/v2/clash/radar.js +13 -0
- package/lib/v2/clash/router.js +3 -0
- package/lib/v2/gdut/maintainer.js +3 -0
- package/lib/{routes/universities → v2}/gdut/news.js +4 -0
- package/lib/v2/gdut/oa_news.js +214 -0
- package/lib/v2/gdut/radar.js +13 -0
- package/lib/v2/gdut/router.js +3 -0
- package/lib/v2/github/maintainer.js +1 -1
- package/lib/v2/github/templates/trending-description.art +5 -0
- package/lib/v2/github/trending.js +32 -16
- package/lib/v2/gov/maintainer.js +2 -0
- package/lib/v2/gov/moj/aac/news.js +49 -0
- package/lib/v2/gov/nifdc/index.js +86 -0
- package/lib/v2/gov/radar.js +22 -0
- package/lib/v2/gov/router.js +2 -0
- package/lib/v2/gov/shanghai/yjj/index.js +16 -10
- package/lib/v2/hakkatv/maintainer.js +3 -0
- package/lib/v2/hakkatv/radar.js +13 -0
- package/lib/v2/hakkatv/router.js +3 -0
- package/lib/v2/hakkatv/type.js +67 -0
- package/lib/v2/hk01/channel.js +13 -30
- package/lib/v2/hk01/hot.js +13 -14
- package/lib/v2/hk01/issue.js +12 -31
- package/lib/v2/hk01/maintainer.js +5 -5
- package/lib/v2/hk01/radar.js +19 -19
- package/lib/v2/hk01/router.js +4 -4
- package/lib/v2/hk01/tag.js +14 -15
- package/lib/v2/hk01/templates/description.art +53 -0
- package/lib/v2/hk01/utils.js +43 -0
- package/lib/v2/hk01/zone.js +15 -34
- package/lib/v2/houxu/events.js +37 -0
- package/lib/v2/houxu/index.js +21 -69
- package/lib/v2/houxu/lives.js +35 -0
- package/lib/v2/houxu/maintainer.js +4 -2
- package/lib/v2/houxu/memory.js +37 -0
- package/lib/v2/houxu/radar.js +18 -6
- package/lib/v2/houxu/router.js +6 -1
- package/lib/v2/houxu/templates/events.art +5 -0
- package/lib/v2/houxu/templates/lives.art +5 -0
- package/lib/v2/houxu/templates/memory.art +3 -0
- package/lib/v2/myfigurecollection/activity.js +58 -0
- package/lib/v2/myfigurecollection/index.js +78 -0
- package/lib/v2/myfigurecollection/maintainer.js +4 -0
- package/lib/v2/myfigurecollection/radar.js +44 -0
- package/lib/v2/myfigurecollection/router.js +4 -0
- package/lib/v2/myfigurecollection/templates/activity.art +8 -0
- package/lib/v2/myfigurecollection/templates/description.art +24 -0
- package/lib/v2/ncepu/maintainer.js +3 -0
- package/lib/v2/ncepu/master/masterinfo.js +78 -0
- package/lib/v2/ncepu/radar.js +25 -0
- package/lib/v2/ncepu/router.js +3 -0
- package/lib/{routes → v2}/nga/forum.js +8 -9
- package/lib/v2/nga/maintainer.js +4 -0
- package/lib/{routes → v2}/nga/post.js +16 -15
- package/lib/v2/nga/radar.js +56 -0
- package/lib/v2/nga/router.js +4 -0
- package/lib/v2/oo-software/changelog.js +40 -0
- package/lib/v2/oo-software/maintainer.js +3 -0
- package/lib/v2/oo-software/radar.js +13 -0
- package/lib/v2/oo-software/router.js +3 -0
- package/lib/{routes/outagereport/service.js → v2/outagereport/index.js} +2 -2
- package/lib/v2/outagereport/maintainer.js +3 -0
- package/lib/v2/outagereport/radar.js +13 -0
- package/lib/v2/outagereport/router.js +3 -0
- package/lib/v2/peopo/maintainer.js +3 -0
- package/lib/v2/peopo/radar.js +13 -0
- package/lib/v2/peopo/router.js +3 -0
- package/lib/v2/peopo/topic.js +46 -0
- package/lib/v2/pts/curations.js +44 -0
- package/lib/v2/pts/{dailynews.js → index.js} +24 -11
- package/lib/v2/pts/maintainer.js +6 -0
- package/lib/v2/pts/projects.js +44 -0
- package/lib/v2/pts/radar.js +38 -2
- package/lib/v2/pts/router.js +4 -1
- package/lib/v2/pts/templates/description.art +6 -0
- package/lib/v2/sakurazaka46/blog.js +1 -1
- package/lib/v2/sakurazaka46/maintainer.js +1 -0
- package/lib/v2/sakurazaka46/news.js +51 -0
- package/lib/v2/sakurazaka46/radar.js +6 -0
- package/lib/v2/sakurazaka46/router.js +1 -0
- package/lib/v2/scitation/journal.js +37 -50
- package/lib/v2/scitation/section.js +38 -56
- package/lib/v2/scitation/templates/description.art +4 -7
- package/lib/v2/scitation/utils.js +29 -0
- package/lib/v2/sinchew/index.js +68 -0
- package/lib/v2/sinchew/maintainer.js +5 -0
- package/lib/v2/sinchew/radar.js +25 -0
- package/lib/v2/sinchew/router.js +4 -0
- package/lib/v2/sinchew/templates/images.art +4 -0
- package/lib/v2/taiwannews/hot.js +52 -0
- package/lib/v2/taiwannews/maintainer.js +3 -0
- package/lib/v2/taiwannews/radar.js +13 -0
- package/lib/v2/taiwannews/router.js +3 -0
- package/lib/v2/test/index.js +2 -0
- package/lib/v2/tju/cic/index.js +113 -0
- package/lib/v2/tju/maintainer.js +6 -0
- package/lib/v2/tju/news/index.js +135 -0
- package/lib/v2/tju/oaa/index.js +112 -0
- package/lib/v2/tju/radar.js +97 -0
- package/lib/v2/tju/router.js +6 -0
- package/lib/v2/tju/yzb/index.js +121 -0
- package/lib/v2/tribalfootball/latest.js +68 -0
- package/lib/v2/tribalfootball/maintainer.js +3 -0
- package/lib/v2/tribalfootball/radar.js +13 -0
- package/lib/v2/tribalfootball/router.js +3 -0
- package/lib/v2/tribalfootball/templates/plus_header.art +6 -0
- package/lib/v2/youzhiyouxing/materials.js +5 -5
- package/lib/v2/zhihu/question.js +5 -3
- package/lib/v2/zhihu/router.js +1 -1
- package/lib/v2/zhihu/zhuanlan.js +2 -2
- package/package.json +19 -19
- package/lib/routes/universities/tjpyu/ooa.js +0 -73
- package/lib/v2/36kr/motif.js +0 -36
- package/lib/v2/36kr/news.js +0 -56
- package/lib/v2/36kr/newsflashes.js +0 -37
- package/lib/v2/36kr/search/article.js +0 -27
- package/lib/v2/36kr/user.js +0 -61
- package/lib/v2/houxu/templates/description.art +0 -9
|
@@ -179,26 +179,30 @@ module.exports = async (ctx, next) => {
|
|
|
179
179
|
const title = item.title || '';
|
|
180
180
|
const description = item.description || title;
|
|
181
181
|
const author = item.author || '';
|
|
182
|
-
const
|
|
182
|
+
const category = item.category || [];
|
|
183
|
+
const isFilter =
|
|
184
|
+
title.match(makeRegex(ctx.query.filter)) || description.match(makeRegex(ctx.query.filter)) || author.match(makeRegex(ctx.query.filter)) || category.some((c) => c.match(makeRegex(ctx.query.filter)));
|
|
183
185
|
return isFilter;
|
|
184
186
|
});
|
|
185
187
|
}
|
|
186
188
|
|
|
187
|
-
// 启用filter参数时,无效filter_title/description/author
|
|
188
|
-
if (!ctx.query.filter && (ctx.query.filter_title || ctx.query.filter_description || ctx.query.filter_author)) {
|
|
189
|
+
// 启用filter参数时,无效filter_title/description/author/category
|
|
190
|
+
if (!ctx.query.filter && (ctx.query.filter_title || ctx.query.filter_description || ctx.query.filter_author || ctx.query.filter_category)) {
|
|
189
191
|
ctx.state.data.item = ctx.state.data.item.filter((item) => {
|
|
190
192
|
const title = item.title || '';
|
|
191
193
|
const description = item.description || title;
|
|
192
194
|
const author = item.author || '';
|
|
195
|
+
const category = item.category || [];
|
|
193
196
|
let isFilter = true;
|
|
194
197
|
ctx.query.filter_title && (isFilter = title.match(makeRegex(ctx.query.filter_title)));
|
|
195
198
|
ctx.query.filter_description && (isFilter = isFilter && description.match(makeRegex(ctx.query.filter_description)));
|
|
196
199
|
ctx.query.filter_author && (isFilter = isFilter && author.match(makeRegex(ctx.query.filter_author)));
|
|
200
|
+
ctx.query.filter_category && (isFilter = isFilter && category.some((c) => c.match(makeRegex(ctx.query.filter_category))));
|
|
197
201
|
return isFilter;
|
|
198
202
|
});
|
|
199
203
|
}
|
|
200
204
|
|
|
201
|
-
if (ctx.query.filterout || ctx.query.filterout_title || ctx.query.filterout_description || ctx.query.filterout_author) {
|
|
205
|
+
if (ctx.query.filterout || ctx.query.filterout_title || ctx.query.filterout_description || ctx.query.filterout_author || ctx.query.filterout_category) {
|
|
202
206
|
if (ctx.query.filterout) {
|
|
203
207
|
ctx.query.filterout_title = ctx.query.filterout;
|
|
204
208
|
ctx.query.filterout_description = ctx.query.filterout;
|
|
@@ -207,10 +211,12 @@ module.exports = async (ctx, next) => {
|
|
|
207
211
|
const title = item.title;
|
|
208
212
|
const description = item.description || title;
|
|
209
213
|
const author = item.author || '';
|
|
214
|
+
const category = item.category || [];
|
|
210
215
|
let isFilter = true;
|
|
211
216
|
ctx.query.filterout_title && (isFilter = !title.match(makeRegex(ctx.query.filterout_title)));
|
|
212
217
|
ctx.query.filterout_description && (isFilter = isFilter && !description.match(makeRegex(ctx.query.filterout_description)));
|
|
213
218
|
ctx.query.filterout_author && (isFilter = isFilter && !author.match(makeRegex(ctx.query.filterout_author)));
|
|
219
|
+
ctx.query.filterout_category && (isFilter = isFilter && !category.some((c) => c.match(makeRegex(ctx.query.filterout_category))));
|
|
214
220
|
return isFilter;
|
|
215
221
|
});
|
|
216
222
|
}
|
package/lib/radar-rules.js
CHANGED
|
@@ -369,23 +369,6 @@ module.exports = {
|
|
|
369
369
|
},
|
|
370
370
|
],
|
|
371
371
|
},
|
|
372
|
-
'nga.cn': {
|
|
373
|
-
_name: 'NGA',
|
|
374
|
-
bbs: [
|
|
375
|
-
{
|
|
376
|
-
title: '分区帖子',
|
|
377
|
-
docs: 'https://docs.rsshub.app/bbs.html#nga',
|
|
378
|
-
source: '/thread.php',
|
|
379
|
-
target: (params, url) => new URL(url).searchParams.get('fid') && `/nga/forum/${new URL(url).searchParams.get('fid')}`,
|
|
380
|
-
},
|
|
381
|
-
{
|
|
382
|
-
title: '帖子',
|
|
383
|
-
docs: 'https://docs.rsshub.app/bbs.html#nga',
|
|
384
|
-
source: '/read.php',
|
|
385
|
-
target: (params, url) => new URL(url).searchParams.get('tid') && `/nga/post/${new URL(url).searchParams.get('tid')}`,
|
|
386
|
-
},
|
|
387
|
-
],
|
|
388
|
-
},
|
|
389
372
|
'playstation.com': {
|
|
390
373
|
_name: 'PlayStation',
|
|
391
374
|
store: [
|
|
@@ -1164,26 +1147,26 @@ module.exports = {
|
|
|
1164
1147
|
},
|
|
1165
1148
|
],
|
|
1166
1149
|
},
|
|
1167
|
-
'biquge5200.com': {
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
},
|
|
1177
|
-
'biquge.info': {
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
},
|
|
1150
|
+
// 'biquge5200.com': {
|
|
1151
|
+
// www: [
|
|
1152
|
+
// {
|
|
1153
|
+
// title: 'biquge5200.com',
|
|
1154
|
+
// docs: 'https://docs.rsshub.app/reading.html#bi-qu-ge-biquge5200-com',
|
|
1155
|
+
// source: '/:id',
|
|
1156
|
+
// target: '/novel/biquge/:id',
|
|
1157
|
+
// },
|
|
1158
|
+
// ],
|
|
1159
|
+
// },
|
|
1160
|
+
// 'biquge.info': {
|
|
1161
|
+
// www: [
|
|
1162
|
+
// {
|
|
1163
|
+
// title: 'biquge.info',
|
|
1164
|
+
// docs: 'https://docs.rsshub.app/reading.html#bi-qu-ge-biquge-info',
|
|
1165
|
+
// source: '/:id',
|
|
1166
|
+
// target: '/novel/biqugeinfo/:id',
|
|
1167
|
+
// },
|
|
1168
|
+
// ],
|
|
1169
|
+
// },
|
|
1187
1170
|
'matters.news': {
|
|
1188
1171
|
_name: 'Matters',
|
|
1189
1172
|
'.': [
|
package/lib/router.js
CHANGED
|
@@ -460,8 +460,8 @@ router.get('/mafengwo/ziyouxing/:code', lazyloadRouteHandler('./routes/mafengwo/
|
|
|
460
460
|
// router.get('/earthquake/ceic/:type', lazyloadRouteHandler('./routes/earthquake/ceic'));
|
|
461
461
|
|
|
462
462
|
// 小说
|
|
463
|
-
router.get('/novel/biquge/:id', lazyloadRouteHandler('./routes/novel/biquge'));
|
|
464
|
-
router.get('/novel/biqugeinfo/:id/:limit?', lazyloadRouteHandler('./routes/novel/biqugeinfo'));
|
|
463
|
+
// router.get('/novel/biquge/:id', lazyloadRouteHandler('./routes/novel/biquge'));
|
|
464
|
+
// router.get('/novel/biqugeinfo/:id/:limit?', lazyloadRouteHandler('./routes/novel/biqugeinfo'));
|
|
465
465
|
router.get('/novel/uukanshu/:uid', lazyloadRouteHandler('./routes/novel/uukanshu'));
|
|
466
466
|
router.get('/novel/wenxuemi/:id1/:id2', lazyloadRouteHandler('./routes/novel/wenxuemi'));
|
|
467
467
|
router.get('/novel/booksky/:id', lazyloadRouteHandler('./routes/novel/booksky'));
|
|
@@ -588,7 +588,7 @@ router.get('/scnu/library', lazyloadRouteHandler('./routes/universities/scnu/lib
|
|
|
588
588
|
router.get('/scnu/cs/match', lazyloadRouteHandler('./routes/universities/scnu/cs/match'));
|
|
589
589
|
|
|
590
590
|
// 广东工业大学
|
|
591
|
-
router.get('/gdut/news', lazyloadRouteHandler('./routes/universities/gdut/news'));
|
|
591
|
+
// router.get('/gdut/news', lazyloadRouteHandler('./routes/universities/gdut/news'));
|
|
592
592
|
|
|
593
593
|
// 中国科学院
|
|
594
594
|
router.get('/cas/sim/academic', lazyloadRouteHandler('./routes/universities/cas/sim/academic'));
|
|
@@ -731,8 +731,8 @@ router.get('/wzbc/:type?', lazyloadRouteHandler('./routes/universities/wzbc/news
|
|
|
731
731
|
// 河南大学
|
|
732
732
|
router.get('/henu/:type?', lazyloadRouteHandler('./routes/universities/henu/news'));
|
|
733
733
|
|
|
734
|
-
// 天津大学
|
|
735
|
-
router.get('/
|
|
734
|
+
// 天津大学 migrated to v2
|
|
735
|
+
// router.get('/tju/oaa/:type?', lazyloadRouteHandler('./routes/universities/tju/oaa'));
|
|
736
736
|
|
|
737
737
|
// 南开大学
|
|
738
738
|
router.get('/nku/jwc/:type?', lazyloadRouteHandler('./routes/universities/nku/jwc/index'));
|
|
@@ -1060,9 +1060,9 @@ router.get('/coolbuy/newest', lazyloadRouteHandler('./routes/coolbuy/newest'));
|
|
|
1060
1060
|
router.get('/miniflux/subscription/:parameters?', lazyloadRouteHandler('./routes/miniflux/get_feeds'));
|
|
1061
1061
|
router.get('/miniflux/:feeds/:parameters?', lazyloadRouteHandler('./routes/miniflux/get_entries'));
|
|
1062
1062
|
|
|
1063
|
-
// NGA
|
|
1064
|
-
router.get('/nga/forum/:fid/:recommend?', lazyloadRouteHandler('./routes/nga/forum'));
|
|
1065
|
-
router.get('/nga/post/:tid', lazyloadRouteHandler('./routes/nga/post'));
|
|
1063
|
+
// NGA migrated to v2
|
|
1064
|
+
// router.get('/nga/forum/:fid/:recommend?', lazyloadRouteHandler('./routes/nga/forum'));
|
|
1065
|
+
// router.get('/nga/post/:tid', lazyloadRouteHandler('./routes/nga/post'));
|
|
1066
1066
|
|
|
1067
1067
|
// Nautilus
|
|
1068
1068
|
router.get('/nautilus/topic/:tid', lazyloadRouteHandler('./routes/nautilus/topics'));
|
|
@@ -1726,7 +1726,7 @@ router.get('/metacritic/release/:platform/:type/:sort?', lazyloadRouteHandler('.
|
|
|
1726
1726
|
router.get('/kkj/news', lazyloadRouteHandler('./routes/kkj/news'));
|
|
1727
1727
|
|
|
1728
1728
|
// Outage.Report
|
|
1729
|
-
router.get('/outagereport/:name/:count?', lazyloadRouteHandler('./routes/outagereport/service'));
|
|
1729
|
+
// router.get('/outagereport/:name/:count?', lazyloadRouteHandler('./routes/outagereport/service'));
|
|
1730
1730
|
|
|
1731
1731
|
// sixthtone
|
|
1732
1732
|
router.get('/sixthtone/news', lazyloadRouteHandler('./routes/sixthtone/news'));
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
const cheerio = require('cheerio');
|
|
3
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
4
|
+
const CryptoJS = require('crypto-js');
|
|
5
|
+
|
|
6
|
+
const shortcuts = {
|
|
7
|
+
'/information': '/information/web_news',
|
|
8
|
+
'/information/latest': '/information/web_news',
|
|
9
|
+
'/information/recommend': '/information/web_recommend',
|
|
10
|
+
'/information/life': '/information/happy_life',
|
|
11
|
+
'/information/estate': '/information/real_estate',
|
|
12
|
+
'/information/workplace': '/information/web_zhichang',
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
module.exports = async (ctx) => {
|
|
16
|
+
const path = ctx.path.replace(/^\/news(?!flashes)/, '/information').replace(/\/search\/article/, '/search/articles');
|
|
17
|
+
|
|
18
|
+
const rootUrl = 'https://www.36kr.com';
|
|
19
|
+
const currentUrl = `${rootUrl}${shortcuts.hasOwnProperty(path) ? shortcuts[path] : path}`;
|
|
20
|
+
|
|
21
|
+
const response = await got({
|
|
22
|
+
method: 'get',
|
|
23
|
+
url: currentUrl,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const $ = cheerio.load(response.data);
|
|
27
|
+
|
|
28
|
+
const data = JSON.parse(response.data.match(/"itemList":(\[.*?\])/)[1]);
|
|
29
|
+
|
|
30
|
+
let items = data.slice(0, ctx.query.limit ? parseInt(ctx.query.limit) : 30).map((item) => {
|
|
31
|
+
item = item.templateMaterial ?? item;
|
|
32
|
+
return {
|
|
33
|
+
title: item.widgetTitle.replace(/<\/?em>/g, ''),
|
|
34
|
+
author: item.author,
|
|
35
|
+
pubDate: parseDate(item.publishTime),
|
|
36
|
+
link: `${rootUrl}/${path === '/newsflashes' ? 'newsflashes' : 'p'}/${item.itemId}`,
|
|
37
|
+
description: item.widgetContent ?? item.content,
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
if (!/^\/(search|newsflashes)/.test(path)) {
|
|
42
|
+
items = await Promise.all(
|
|
43
|
+
items.map((item) =>
|
|
44
|
+
ctx.cache.tryGet(item.link, async () => {
|
|
45
|
+
const detailResponse = await got({
|
|
46
|
+
method: 'get',
|
|
47
|
+
url: item.link,
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const key = CryptoJS.enc.Utf8.parse('efabccee-b754-4c');
|
|
51
|
+
const cipherText = detailResponse.data.match(/{"state":"(.*)","isEncrypt":true}/)[1];
|
|
52
|
+
|
|
53
|
+
const content = JSON.parse(
|
|
54
|
+
CryptoJS.AES.decrypt(cipherText, key, {
|
|
55
|
+
mode: CryptoJS.mode.ECB,
|
|
56
|
+
padding: CryptoJS.pad.Pkcs7,
|
|
57
|
+
})
|
|
58
|
+
.toString(CryptoJS.enc.Utf8)
|
|
59
|
+
.toString()
|
|
60
|
+
).articleDetail.articleDetailData.data;
|
|
61
|
+
|
|
62
|
+
item.description = content.widgetContent;
|
|
63
|
+
|
|
64
|
+
return item;
|
|
65
|
+
})
|
|
66
|
+
)
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
ctx.state.data = {
|
|
71
|
+
title: `36氪 - ${$('title').text().split('_')[0]}`,
|
|
72
|
+
link: currentUrl,
|
|
73
|
+
item: items,
|
|
74
|
+
};
|
|
75
|
+
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
'/
|
|
3
|
-
'/
|
|
4
|
-
'/newsflashes': ['hillerliao'],
|
|
5
|
-
'/search/
|
|
6
|
-
'/
|
|
2
|
+
'/information/:category?': ['nczitzk'],
|
|
3
|
+
'/motif/:id': ['nczitzk'],
|
|
4
|
+
'/newsflashes': ['hillerliao', 'nczitzk'],
|
|
5
|
+
'/search/articles/:keyword': ['xyqfer', 'kt286', 'nczitzk'],
|
|
6
|
+
'/search/newsflashes/:keyword': ['nczitzk'],
|
|
7
|
+
'/topics/:id': ['nczitzk'],
|
|
8
|
+
'/user/:id': ['nczitzk'],
|
|
7
9
|
};
|
package/lib/v2/36kr/radar.js
CHANGED
|
@@ -1,36 +1,48 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
'36kr.com': {
|
|
3
|
-
_name: '
|
|
3
|
+
_name: '36氪',
|
|
4
4
|
'.': [
|
|
5
5
|
{
|
|
6
6
|
title: '资讯',
|
|
7
|
-
docs: 'https://docs.rsshub.app/new-media.html#_36kr',
|
|
8
|
-
source: '/',
|
|
9
|
-
target: '/36kr/
|
|
7
|
+
docs: 'https://docs.rsshub.app/new-media.html#_36kr-zi-xun',
|
|
8
|
+
source: ['/information/:category', '/'],
|
|
9
|
+
target: '/36kr/information/:category',
|
|
10
10
|
},
|
|
11
11
|
{
|
|
12
12
|
title: '快讯',
|
|
13
|
-
docs: 'https://docs.rsshub.app/new-media.html#_36kr',
|
|
14
|
-
source: '/',
|
|
13
|
+
docs: 'https://docs.rsshub.app/new-media.html#_36kr-kuai-xun',
|
|
14
|
+
source: ['/newsflashes', '/'],
|
|
15
15
|
target: '/36kr/newsflashes',
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
title: '用户文章',
|
|
19
|
-
docs: 'https://docs.rsshub.app/new-media.html#_36kr',
|
|
20
|
-
source: '/user/:
|
|
21
|
-
target: '/36kr/user/:
|
|
19
|
+
docs: 'https://docs.rsshub.app/new-media.html#_36kr-yong-hu-wen-zhang',
|
|
20
|
+
source: ['/user/:id', '/'],
|
|
21
|
+
target: '/36kr/user/:id',
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
24
|
title: '主题文章',
|
|
25
|
-
docs: 'https://docs.rsshub.app/new-media.html#_36kr',
|
|
26
|
-
source: '/motif/:
|
|
27
|
-
target: '/36kr/motif/:
|
|
25
|
+
docs: 'https://docs.rsshub.app/new-media.html#_36kr-zhu-ti-wen-zhang',
|
|
26
|
+
source: ['/motif/:id', '/'],
|
|
27
|
+
target: '/36kr/motif/:id',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
title: '专题文章',
|
|
31
|
+
docs: 'https://docs.rsshub.app/new-media.html#_36kr-zhuan-ti-wen-zhang',
|
|
32
|
+
source: ['/topics/:id', '/'],
|
|
33
|
+
target: '/36kr/topics/:id',
|
|
28
34
|
},
|
|
29
35
|
{
|
|
30
36
|
title: '搜索文章',
|
|
31
|
-
docs: 'https://docs.rsshub.app/new-media.html#_36kr',
|
|
32
|
-
source: '/search/articles/:keyword',
|
|
33
|
-
target: '/36kr/search/
|
|
37
|
+
docs: 'https://docs.rsshub.app/new-media.html#_36kr-sou-suo-wen-zhang',
|
|
38
|
+
source: ['/search/articles/:keyword', '/'],
|
|
39
|
+
target: '/36kr/search/articles/:keyword',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
title: '搜索快讯',
|
|
43
|
+
docs: 'https://docs.rsshub.app/new-media.html#_36kr-sou-suo-kuai-xun',
|
|
44
|
+
source: ['/search/newsflashes/:keyword', '/'],
|
|
45
|
+
target: '/36kr/search/newsflashes/:keyword',
|
|
34
46
|
},
|
|
35
47
|
],
|
|
36
48
|
},
|
package/lib/v2/36kr/router.js
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
1
|
module.exports = (router) => {
|
|
2
|
-
router.get(
|
|
3
|
-
router.get('/news/:category?', require('./news'));
|
|
4
|
-
router.get('/newsflashes', require('./newsflashes'));
|
|
5
|
-
router.get('/search/article/:keyword', require('./search/article'));
|
|
6
|
-
router.get('/user/:id', require('./user'));
|
|
2
|
+
router.get(/([\w-/]+)?/, require('./index'));
|
|
7
3
|
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
const cheerio = require('cheerio');
|
|
2
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
3
|
+
const { art } = require('@/utils/render');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const config = require('@/config').value;
|
|
6
|
+
|
|
7
|
+
module.exports = async (ctx) => {
|
|
8
|
+
const id = ctx.params.id ?? '';
|
|
9
|
+
|
|
10
|
+
const rootUrl = 'https://pubs.acs.org';
|
|
11
|
+
const currentUrl = `${rootUrl}/toc/${id}/0/0`;
|
|
12
|
+
|
|
13
|
+
let title = '';
|
|
14
|
+
|
|
15
|
+
const browser = await require('@/utils/puppeteer')();
|
|
16
|
+
const items = await ctx.cache.tryGet(
|
|
17
|
+
currentUrl,
|
|
18
|
+
async () => {
|
|
19
|
+
const page = await browser.newPage();
|
|
20
|
+
await page.setRequestInterception(true);
|
|
21
|
+
page.on('request', (request) => {
|
|
22
|
+
request.resourceType() === 'document' || request.resourceType() === 'script' ? request.continue() : request.abort();
|
|
23
|
+
});
|
|
24
|
+
await page.goto(currentUrl, {
|
|
25
|
+
waitUntil: 'domcontentloaded',
|
|
26
|
+
});
|
|
27
|
+
await page.waitForSelector('.toc');
|
|
28
|
+
|
|
29
|
+
const html = await page.evaluate(() => document.documentElement.innerHTML);
|
|
30
|
+
await page.close();
|
|
31
|
+
|
|
32
|
+
const $ = cheerio.load(html);
|
|
33
|
+
|
|
34
|
+
title = $('meta[property="og:title"]').attr('content');
|
|
35
|
+
|
|
36
|
+
return $('.issue-item')
|
|
37
|
+
.toArray()
|
|
38
|
+
.map((item) => {
|
|
39
|
+
item = $(item);
|
|
40
|
+
|
|
41
|
+
const a = item.find('.issue-item_title a');
|
|
42
|
+
const doi = item.find('input[name="doi"]').attr('value');
|
|
43
|
+
|
|
44
|
+
return {
|
|
45
|
+
doi,
|
|
46
|
+
guid: doi,
|
|
47
|
+
title: a.text(),
|
|
48
|
+
link: `${rootUrl}${a.attr('href')}`,
|
|
49
|
+
pubDate: parseDate(item.find('.pub-date-value').text(), 'MMMM D, YYYY'),
|
|
50
|
+
author: item
|
|
51
|
+
.find('.issue-item_loa li')
|
|
52
|
+
.toArray()
|
|
53
|
+
.map((a) => $(a).text())
|
|
54
|
+
.join(', '),
|
|
55
|
+
description: art(path.join(__dirname, 'templates/description.art'), {
|
|
56
|
+
image: item.find('.issue-item_img').html(),
|
|
57
|
+
description: item.find('.hlFld-Abstract').html(),
|
|
58
|
+
}),
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
},
|
|
62
|
+
config.cache.routeExpire,
|
|
63
|
+
false
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
await browser.close();
|
|
67
|
+
|
|
68
|
+
ctx.state.data = {
|
|
69
|
+
title,
|
|
70
|
+
link: currentUrl,
|
|
71
|
+
item: items,
|
|
72
|
+
};
|
|
73
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
'acs.org': {
|
|
3
|
+
_name: 'American Chemistry Society',
|
|
4
|
+
pubs: [
|
|
5
|
+
{
|
|
6
|
+
title: 'Journal',
|
|
7
|
+
docs: 'https://docs.rsshub.app/journal.html#american-chemistry-society',
|
|
8
|
+
source: ['/journal/:id', '/'],
|
|
9
|
+
target: '/acs/journal/:id',
|
|
10
|
+
},
|
|
11
|
+
],
|
|
12
|
+
},
|
|
13
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
const cheerio = require('cheerio');
|
|
3
|
+
const buildData = require('@/utils/common-config');
|
|
4
|
+
const baseUrl = 'https://www.airchina.com.cn';
|
|
5
|
+
|
|
6
|
+
module.exports = async (ctx) => {
|
|
7
|
+
const link = `${baseUrl}/cn/info/new-service/service_announcement.shtml`;
|
|
8
|
+
ctx.state.data = await buildData({
|
|
9
|
+
link,
|
|
10
|
+
url: link,
|
|
11
|
+
title: `%title%`,
|
|
12
|
+
description: `%description%`,
|
|
13
|
+
params: {
|
|
14
|
+
title: '国航服务公告',
|
|
15
|
+
description: '中国国际航空公司服务公告',
|
|
16
|
+
},
|
|
17
|
+
item: {
|
|
18
|
+
item: '.serviceMsg li',
|
|
19
|
+
title: `$('a').text()`,
|
|
20
|
+
link: `$('a').attr('href')`,
|
|
21
|
+
pubDate: `parseDate($('span').text(), 'YYYY-MM-DD')`,
|
|
22
|
+
guid: Buffer.from(`$('a').attr('href')`).toString('base64'),
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
await Promise.all(
|
|
27
|
+
ctx.state.data.item.map(async (item) => {
|
|
28
|
+
const detailLink = baseUrl + item.link;
|
|
29
|
+
item.description = await ctx.cache.tryGet(detailLink, async () => {
|
|
30
|
+
const result = await got(detailLink);
|
|
31
|
+
const $ = cheerio.load(result.data);
|
|
32
|
+
return $('.serviceMsg').html();
|
|
33
|
+
});
|
|
34
|
+
})
|
|
35
|
+
);
|
|
36
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
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
|
+
const category = ctx.params.category ?? 'posts';
|
|
8
|
+
|
|
9
|
+
const rootUrl = 'https://allrecode.com';
|
|
10
|
+
const currentUrl = `${rootUrl}/${category}`;
|
|
11
|
+
|
|
12
|
+
const response = await got({
|
|
13
|
+
method: 'get',
|
|
14
|
+
url: currentUrl,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const $ = cheerio.load(response.data);
|
|
18
|
+
|
|
19
|
+
let items = $('h3 a')
|
|
20
|
+
.toArray()
|
|
21
|
+
.map((item) => {
|
|
22
|
+
item = $(item);
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
title: item.text(),
|
|
26
|
+
link: item.attr('href'),
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
items = await Promise.all(
|
|
31
|
+
items.map((item) =>
|
|
32
|
+
ctx.cache.tryGet(item.link, async () => {
|
|
33
|
+
const detailResponse = await got({
|
|
34
|
+
method: 'get',
|
|
35
|
+
url: item.link,
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const content = cheerio.load(detailResponse.data);
|
|
39
|
+
|
|
40
|
+
item.author = content('.author').text();
|
|
41
|
+
item.category = content('meta[name="keywords"]').attr('content').split(',');
|
|
42
|
+
item.pubDate = timezone(
|
|
43
|
+
parseDate(
|
|
44
|
+
content('.edit')
|
|
45
|
+
.text()
|
|
46
|
+
.match(/\d{4}-\d{2}-\d{2} \d{2}:\d{2}/)
|
|
47
|
+
),
|
|
48
|
+
+8
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
content('.edit, .shang').remove();
|
|
52
|
+
|
|
53
|
+
item.description = content('.article-content').html();
|
|
54
|
+
|
|
55
|
+
return item;
|
|
56
|
+
})
|
|
57
|
+
)
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
ctx.state.data = {
|
|
61
|
+
title: $('title').text(),
|
|
62
|
+
link: currentUrl,
|
|
63
|
+
item: items,
|
|
64
|
+
};
|
|
65
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
const rootUrl = 'https://allrecode.com';
|
|
8
|
+
const currentUrl = `${rootUrl}/news`;
|
|
9
|
+
|
|
10
|
+
const response = await got({
|
|
11
|
+
method: 'get',
|
|
12
|
+
url: currentUrl,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const $ = cheerio.load(response.data);
|
|
16
|
+
|
|
17
|
+
const items = $('.news-trigger')
|
|
18
|
+
.toArray()
|
|
19
|
+
.map((item) => {
|
|
20
|
+
item = $(item);
|
|
21
|
+
|
|
22
|
+
return {
|
|
23
|
+
title: item.text(),
|
|
24
|
+
link: item.attr('href'),
|
|
25
|
+
pubDate: timezone(parseDate(item.parent().prev().text(), 'HH:mm'), +8),
|
|
26
|
+
description: item.parent().next().html(),
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
ctx.state.data = {
|
|
31
|
+
title: $('title').text(),
|
|
32
|
+
link: currentUrl,
|
|
33
|
+
item: items,
|
|
34
|
+
};
|
|
35
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
'allrecode.com': {
|
|
3
|
+
_name: '重构',
|
|
4
|
+
'.': [
|
|
5
|
+
{
|
|
6
|
+
title: '推荐',
|
|
7
|
+
docs: 'https://docs.rsshub.app/news-media.html#chong-gou-tui-jian',
|
|
8
|
+
source: ['/recommends', '/'],
|
|
9
|
+
target: '/allrecode/recommends',
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
title: '快讯',
|
|
13
|
+
docs: 'https://docs.rsshub.app/news-media.html#chong-gou-kuai-xun',
|
|
14
|
+
source: ['/news', '/'],
|
|
15
|
+
target: '/allrecode/news',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
title: '资讯',
|
|
19
|
+
docs: 'https://docs.rsshub.app/news-media.html#chong-gou-zi-xun',
|
|
20
|
+
source: ['/:category', '/'],
|
|
21
|
+
target: '/allrecode/:category',
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
};
|