rsshub 1.0.0-master.f1c53d1 → 1.0.0-master.f1e7c90
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/radar-rules.js +0 -12
- package/lib/router.js +27 -21
- package/lib/routes/tencent/wechat/tgchannel.js +84 -29
- package/lib/v2/36kr/maintainer.js +7 -0
- package/lib/{routes → v2}/36kr/motif.js +2 -1
- package/lib/v2/36kr/news.js +56 -0
- package/lib/{routes → v2}/36kr/newsflashes.js +2 -1
- package/lib/v2/36kr/radar.js +37 -0
- package/lib/v2/36kr/router.js +7 -0
- package/lib/{routes → v2}/36kr/search/article.js +3 -2
- package/lib/{routes → v2}/36kr/user.js +2 -1
- package/lib/v2/abskoop/index.js +52 -0
- package/lib/v2/abskoop/maintainer.js +3 -0
- package/lib/v2/abskoop/radar.js +13 -0
- package/lib/v2/abskoop/router.js +3 -0
- package/lib/v2/abskoop/templates/description.art +3 -0
- package/lib/v2/douban/people/wish.js +2 -1
- package/lib/v2/kbs/maintainer.js +4 -0
- package/lib/v2/kbs/news.js +67 -0
- package/lib/v2/kbs/radar.js +19 -0
- package/lib/v2/kbs/router.js +4 -0
- package/lib/{routes → v2}/kbs/today.js +1 -1
- package/lib/v2/lofter/maintainer.js +4 -0
- package/lib/v2/lofter/radar.js +17 -0
- package/lib/v2/lofter/router.js +4 -0
- package/lib/{routes → v2}/lofter/tag.js +4 -4
- package/lib/v2/lofter/user.js +52 -0
- package/lib/v2/nbd/article.js +50 -0
- package/lib/{routes → v2}/nbd/index.js +8 -5
- package/lib/v2/nbd/maintainer.js +4 -0
- package/lib/v2/nbd/radar.js +19 -0
- package/lib/v2/nbd/router.js +4 -0
- package/lib/v2/njnu/ceai/ceai.js +44 -0
- package/lib/v2/njnu/ceai/utils.js +55 -0
- package/lib/v2/njnu/jwc/jwc.js +43 -0
- package/lib/v2/njnu/jwc/utils.js +59 -0
- package/lib/v2/njnu/maintainer.js +4 -0
- package/lib/v2/njnu/radar.js +21 -0
- package/lib/v2/njnu/router.js +4 -0
- package/lib/v2/nltimes/maintainer.js +3 -0
- package/lib/v2/nltimes/news.js +89 -0
- package/lib/v2/nltimes/radar.js +19 -0
- package/lib/v2/nltimes/router.js +3 -0
- package/lib/v2/readhub/index.js +94 -0
- package/lib/v2/readhub/maintainer.js +3 -0
- package/lib/v2/readhub/radar.js +13 -0
- package/lib/v2/readhub/router.js +6 -0
- package/lib/v2/wfu/jwc.js +54 -0
- package/lib/v2/wfu/maintainer.js +4 -0
- package/lib/v2/wfu/news.js +96 -0
- package/lib/v2/wfu/radar.js +21 -0
- package/lib/v2/wfu/router.js +4 -0
- package/lib/v2/who/maintainer.js +5 -0
- package/lib/v2/who/news-room.js +76 -0
- package/lib/{routes → v2}/who/news.js +1 -1
- package/lib/v2/who/radar.js +25 -0
- package/lib/v2/who/router.js +5 -0
- package/lib/{routes → v2}/who/speeches.js +0 -0
- package/package.json +1 -1
- package/lib/routes/36kr/news.js +0 -94
- package/lib/routes/lofter/posts.js +0 -54
- package/lib/routes/nbd/article.js +0 -60
- package/lib/routes/readhub/category.js +0 -102
- package/lib/routes/who/news-room.js +0 -56
package/lib/config.js
CHANGED
package/lib/radar-rules.js
CHANGED
|
@@ -1977,18 +1977,6 @@ module.exports = {
|
|
|
1977
1977
|
},
|
|
1978
1978
|
],
|
|
1979
1979
|
},
|
|
1980
|
-
'lofter.com': {
|
|
1981
|
-
_name: 'Lofter',
|
|
1982
|
-
www: [
|
|
1983
|
-
{
|
|
1984
|
-
title: '话题 (标签)',
|
|
1985
|
-
docs: 'https://docs.rsshub.app/social-media.html#lofter',
|
|
1986
|
-
source: ['/tag/:name', '/tag/:name/:type'],
|
|
1987
|
-
target: (params) => `/lofter/tag/${params.name}/${params.type || ''}`,
|
|
1988
|
-
},
|
|
1989
|
-
],
|
|
1990
|
-
},
|
|
1991
|
-
|
|
1992
1980
|
'yuque.com': {
|
|
1993
1981
|
_name: '语雀',
|
|
1994
1982
|
www: [
|
package/lib/router.js
CHANGED
|
@@ -242,8 +242,9 @@ router.get('/v2ex/topics/:type', lazyloadRouteHandler('./routes/v2ex/topics'));
|
|
|
242
242
|
router.get('/v2ex/post/:postid', lazyloadRouteHandler('./routes/v2ex/post'));
|
|
243
243
|
router.get('/v2ex/tab/:tabid', lazyloadRouteHandler('./routes/v2ex/tab'));
|
|
244
244
|
|
|
245
|
-
//
|
|
246
|
-
router.get('/readhub/category/:category', lazyloadRouteHandler('./routes/readhub/
|
|
245
|
+
// Readhub migrated to v2
|
|
246
|
+
// router.get('/readhub/category/:category?', lazyloadRouteHandler('./routes/readhub/index'));
|
|
247
|
+
// router.get('/readhub/:category?', lazyloadRouteHandler('./routes/readhub/index'));
|
|
247
248
|
|
|
248
249
|
// f-droid
|
|
249
250
|
router.get('/fdroid/apprelease/:app', lazyloadRouteHandler('./routes/fdroid/apprelease'));
|
|
@@ -466,7 +467,7 @@ router.get('/wechat/csm/:id', lazyloadRouteHandler('./routes/tencent/wechat/csm'
|
|
|
466
467
|
router.get('/wechat/ce/:id', lazyloadRouteHandler('./routes/tencent/wechat/ce'));
|
|
467
468
|
router.get('/wechat/announce', lazyloadRouteHandler('./routes/tencent/wechat/announce'));
|
|
468
469
|
router.get('/wechat/miniprogram/plugins', lazyloadRouteHandler('./routes/tencent/wechat/miniprogram/plugins'));
|
|
469
|
-
router.get('/wechat/tgchannel/:id/:mpName?', lazyloadRouteHandler('./routes/tencent/wechat/tgchannel'));
|
|
470
|
+
router.get('/wechat/tgchannel/:id/:mpName?/:searchQueryType?', lazyloadRouteHandler('./routes/tencent/wechat/tgchannel'));
|
|
470
471
|
router.get('/wechat/uread/:userid', lazyloadRouteHandler('./routes/tencent/wechat/uread'));
|
|
471
472
|
router.get('/wechat/ershicimi/:id', lazyloadRouteHandler('./routes/tencent/wechat/ershcimi'));
|
|
472
473
|
router.get('/wechat/wjdn/:id', lazyloadRouteHandler('./routes/tencent/wechat/wjdn'));
|
|
@@ -748,6 +749,10 @@ router.get('/kmust/job/jobfairs', lazyloadRouteHandler('./routes/universities/km
|
|
|
748
749
|
router.get('/whu/cs/:type', lazyloadRouteHandler('./routes/universities/whu/cs'));
|
|
749
750
|
router.get('/whu/news/:type?', lazyloadRouteHandler('./routes/universities/whu/news'));
|
|
750
751
|
|
|
752
|
+
// 潍坊学院 migrated to v2
|
|
753
|
+
// router.get('/wfu/news/:type?', require('./routes/universities/wfu/news'));
|
|
754
|
+
// router.get('/wfu/jwc', require('./routes/universities/wfu/jwc'));
|
|
755
|
+
|
|
751
756
|
// 华中科技大学
|
|
752
757
|
router.get('/hust/auto/notice/:type?', lazyloadRouteHandler('./routes/universities/hust/aia/notice'));
|
|
753
758
|
router.get('/hust/auto/news', lazyloadRouteHandler('./routes/universities/hust/aia/news'));
|
|
@@ -1203,12 +1208,12 @@ router.get('/bihu/activaties/:id', lazyloadRouteHandler('./routes/bihu/activatie
|
|
|
1203
1208
|
router.get('/tingdiantz/nanjing', lazyloadRouteHandler('./routes/tingdiantz/nanjing'));
|
|
1204
1209
|
router.get('/tingdiantz/95598/:province/:city/:district?', lazyloadRouteHandler('./routes/tingdiantz/95598'));
|
|
1205
1210
|
|
|
1206
|
-
// 36kr
|
|
1207
|
-
router.get('/36kr/search/article/:keyword', lazyloadRouteHandler('./routes/36kr/search/article'));
|
|
1208
|
-
router.get('/36kr/newsflashes', lazyloadRouteHandler('./routes/36kr/newsflashes'));
|
|
1209
|
-
router.get('/36kr/news/:
|
|
1210
|
-
router.get('/36kr/user/:uid', lazyloadRouteHandler('./routes/36kr/user'));
|
|
1211
|
-
router.get('/36kr/motif/:mid', lazyloadRouteHandler('./routes/36kr/motif'));
|
|
1211
|
+
// 36kr migrated to v2
|
|
1212
|
+
// router.get('/36kr/search/article/:keyword', lazyloadRouteHandler('./routes/36kr/search/article'));
|
|
1213
|
+
// router.get('/36kr/newsflashes', lazyloadRouteHandler('./routes/36kr/newsflashes'));
|
|
1214
|
+
// router.get('/36kr/news/:category?', lazyloadRouteHandler('./routes/36kr/news'));
|
|
1215
|
+
// router.get('/36kr/user/:uid', lazyloadRouteHandler('./routes/36kr/user'));
|
|
1216
|
+
// router.get('/36kr/motif/:mid', lazyloadRouteHandler('./routes/36kr/motif'));
|
|
1212
1217
|
|
|
1213
1218
|
// PMCAFF
|
|
1214
1219
|
router.get('/pmcaff/list/:typeid', lazyloadRouteHandler('./routes/pmcaff/list'));
|
|
@@ -1615,10 +1620,10 @@ router.get('/nintendo/news/china', lazyloadRouteHandler('./routes/nintendo/news_
|
|
|
1615
1620
|
router.get('/nintendo/direct', lazyloadRouteHandler('./routes/nintendo/direct'));
|
|
1616
1621
|
router.get('/nintendo/system-update', lazyloadRouteHandler('./routes/nintendo/system-update'));
|
|
1617
1622
|
|
|
1618
|
-
// 世界卫生组织
|
|
1619
|
-
router.get('/who/news-room/:
|
|
1620
|
-
router.get('/who/speeches/:language?', lazyloadRouteHandler('./routes/who/speeches'));
|
|
1621
|
-
router.get('/who/news/:language?', lazyloadRouteHandler('./routes/who/news'));
|
|
1623
|
+
// 世界卫生组织 migrated to v2
|
|
1624
|
+
// router.get('/who/news-room/:category?/:language?', lazyloadRouteHandler('./routes/who/news-room'));
|
|
1625
|
+
// router.get('/who/speeches/:language?', lazyloadRouteHandler('./routes/who/speeches'));
|
|
1626
|
+
// router.get('/who/news/:language?', lazyloadRouteHandler('./routes/who/news'));
|
|
1622
1627
|
|
|
1623
1628
|
// 福利资源-met.red
|
|
1624
1629
|
router.get('/metred/fuli', lazyloadRouteHandler('./routes/metred/fuli'));
|
|
@@ -2174,9 +2179,9 @@ router.get('/taptap/topic/:id/:label?', lazyloadRouteHandler('./routes/taptap/to
|
|
|
2174
2179
|
router.get('/taptap/changelog/:id', lazyloadRouteHandler('./routes/taptap/changelog'));
|
|
2175
2180
|
router.get('/taptap/review/:id/:order?', lazyloadRouteHandler('./routes/taptap/review'));
|
|
2176
2181
|
|
|
2177
|
-
// lofter
|
|
2178
|
-
router.get('/lofter/tag/:name?/:type?', lazyloadRouteHandler('./routes/lofter/tag'));
|
|
2179
|
-
router.get('/lofter/user/:
|
|
2182
|
+
// lofter migrated to v2
|
|
2183
|
+
// router.get('/lofter/tag/:name?/:type?', lazyloadRouteHandler('./routes/lofter/tag'));
|
|
2184
|
+
// router.get('/lofter/user/:name?', lazyloadRouteHandler('./routes/lofter/user'));
|
|
2180
2185
|
|
|
2181
2186
|
// 米坛社区表盘
|
|
2182
2187
|
router.get('/watchface/:watch_type?/:list_type?', lazyloadRouteHandler('./routes/watchface/update'));
|
|
@@ -2195,9 +2200,9 @@ router.get('/wineyun/:category', lazyloadRouteHandler('./routes/wineyun'));
|
|
|
2195
2200
|
router.get('/xiaohongshu/user/:user_id/:category', lazyloadRouteHandler('./routes/xiaohongshu/user'));
|
|
2196
2201
|
router.get('/xiaohongshu/board/:board_id', lazyloadRouteHandler('./routes/xiaohongshu/board'));
|
|
2197
2202
|
|
|
2198
|
-
// 每经网
|
|
2199
|
-
router.get('/nbd/daily', lazyloadRouteHandler('./routes/nbd/article'));
|
|
2200
|
-
router.get('/nbd/:id?', lazyloadRouteHandler('./routes/nbd/index'));
|
|
2203
|
+
// 每经网 migrated to v2
|
|
2204
|
+
// router.get('/nbd/daily', lazyloadRouteHandler('./routes/nbd/article'));
|
|
2205
|
+
// router.get('/nbd/:id?', lazyloadRouteHandler('./routes/nbd/index'));
|
|
2201
2206
|
|
|
2202
2207
|
// 快知
|
|
2203
2208
|
router.get('/kzfeed/topic/:id', lazyloadRouteHandler('./routes/kzfeed/topic'));
|
|
@@ -4177,8 +4182,9 @@ router.get('/fashionnetwork/headline/:country?', lazyloadRouteHandler('./routes/
|
|
|
4177
4182
|
// mirror.xyz
|
|
4178
4183
|
router.get('/mirror/:id', lazyloadRouteHandler('./routes/mirror/entries'));
|
|
4179
4184
|
|
|
4180
|
-
// KBS
|
|
4181
|
-
router.get('/kbs/today/:language?', lazyloadRouteHandler('./routes/kbs/today'));
|
|
4185
|
+
// KBS migrated to v2
|
|
4186
|
+
// router.get('/kbs/today/:language?', lazyloadRouteHandler('./routes/kbs/today'));
|
|
4187
|
+
// router.get('/kbs/news/:category?/:language?', lazyloadRouteHandler('./routes/kbs/news'));
|
|
4182
4188
|
|
|
4183
4189
|
// Deprecated: DO NOT ADD ANY NEWS ROUTES HERE
|
|
4184
4190
|
|
|
@@ -4,8 +4,15 @@ const cheerio = require('cheerio');
|
|
|
4
4
|
module.exports = async (ctx) => {
|
|
5
5
|
const id = ctx.params.id;
|
|
6
6
|
const mpName = ctx.params.mpName ?? '';
|
|
7
|
+
let searchQueryType = ctx.params.searchQueryType ?? '0';
|
|
8
|
+
if (searchQueryType !== '0' && searchQueryType !== '1' && searchQueryType !== '2') {
|
|
9
|
+
searchQueryType = '0';
|
|
10
|
+
}
|
|
11
|
+
searchQueryType = +searchQueryType; // 将字符串转换为数字
|
|
7
12
|
|
|
8
|
-
const
|
|
13
|
+
const channelUrl = `https://t.me/s/${id}`;
|
|
14
|
+
const searchQuery = mpName && searchQueryType ? (searchQueryType === 2 ? `?q=%23${mpName}` : `?q=${mpName}`) : '';
|
|
15
|
+
const { data } = await got.get(`${channelUrl}${searchQuery}`);
|
|
9
16
|
const $ = cheerio.load(data);
|
|
10
17
|
const list = $('.tgme_widget_message_wrap').slice(-20);
|
|
11
18
|
|
|
@@ -14,49 +21,97 @@ module.exports = async (ctx) => {
|
|
|
14
21
|
.map(async (index, item) => {
|
|
15
22
|
item = $(item);
|
|
16
23
|
|
|
24
|
+
if (searchQuery) {
|
|
25
|
+
// 删除关键字高亮 <mark class="highlight">
|
|
26
|
+
const highlightMarks = item.find('mark.highlight').get();
|
|
27
|
+
highlightMarks.forEach((mark) => {
|
|
28
|
+
mark = $(mark);
|
|
29
|
+
const markInnerHtml = mark.html();
|
|
30
|
+
mark.replaceWith(markInnerHtml);
|
|
31
|
+
});
|
|
32
|
+
if (highlightMarks) {
|
|
33
|
+
item = $(item.html()); // 删除关键字高亮后,相邻的裸文本节点不会被自动合并,重新生成 cheerio 对象以确保后续流程正常运行
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
17
37
|
// [ div.tgme_widget_message_text 格式简略说明 ]
|
|
18
38
|
// 若频道只订阅一个公众号:
|
|
19
|
-
// 第 1 个元素: <a href="${用于 link priview 的预览图 url}"><i><b
|
|
39
|
+
// 第 1 个元素: <a href="${用于 link priview 的预览图 url}"><i><b>🔗</b></i></a>
|
|
20
40
|
// 第 2 个元素: <a href="${文章 url}">${文章标题}</a>
|
|
21
41
|
// (余下是文章简介,一般是裸文本,这里用不到)
|
|
22
42
|
//
|
|
23
43
|
// 若频道订阅多于一个公众号:
|
|
24
|
-
// 第 1 个元素: <i><b>${emoji(标注消息来源于什么 slave
|
|
25
|
-
// 第 2 个元素: <i><b>${emoji(
|
|
44
|
+
// 第 1 个元素: <i><b>${emoji(标注消息来源于什么 slave,这里是表示微信的💬)}</b></i>
|
|
45
|
+
// 第 2 个元素: <i><b>${emoji(标注对话类型,这里是表示私聊的👤)</b></i>
|
|
26
46
|
// 裸文本: (半角空格)${公众号名}(半角冒号)
|
|
27
47
|
// 第 3 个元素: <br />
|
|
28
|
-
// 第 4 个元素: <a href="${用于 link priview 的预览图 url}"><i><b
|
|
48
|
+
// 第 4 个元素: <a href="${用于 link priview 的预览图 url}"><i><b>🔗</b></i></a>
|
|
29
49
|
// 第 5 个元素: <a href="${文章 url}">${文章标题}</a>
|
|
30
50
|
// (余下是文章简介,一般是裸文本,这里用不到)
|
|
51
|
+
//
|
|
52
|
+
// 若启用 efb-patch-middleware 且频道订阅多于一个公众号:
|
|
53
|
+
// 第 1 个元素: <i><b>${emoji(标注消息来源于什么 slave,这里是表示微信的💬)}</b></i>
|
|
54
|
+
// 第 2 个元素: <i><b>${emoji(标注对话类型,这里是表示私聊的👤)</b></i>
|
|
55
|
+
// 第 3 个元素: <a href="${?q=%23url-encoded公众号名}">#${公众号名}</a>
|
|
56
|
+
// 裸文本: ${公众号名余下部分 (若 hashtag 不合法 (遇到空格、标点) 导致被截断才会有)}(半角冒号)
|
|
57
|
+
// 第 4 个元素: <br />
|
|
58
|
+
// 第 5 个元素: <a href="${用于 link priview 的预览图 url}"><i><b>🔗</b></i></a>
|
|
59
|
+
// 第 6 个元素: <a href="${文章 url}">${文章标题}</a>
|
|
60
|
+
// (余下是文章简介,一般是裸文本,这里用不到)
|
|
61
|
+
|
|
62
|
+
let author = '';
|
|
63
|
+
let titleElemIs3thA = false;
|
|
64
|
+
|
|
65
|
+
const brNode = item.find('.tgme_widget_message_text > br:nth-of-type(1)').get(0); // 获取第一个换行
|
|
66
|
+
const authorNode = brNode && brNode.prev; // brNode 不为 undefined 时获取它的前一个节点
|
|
67
|
+
const authorNodePrev = authorNode && authorNode.prev; // authorNode 不为 undefined 时获取它的前一个节点
|
|
68
|
+
if (authorNode && authorNode.type === 'text') {
|
|
69
|
+
// 只有这个节点是一个裸文本时它才可能是公众号名,开始找寻公众号名
|
|
70
|
+
if (authorNodePrev && authorNodePrev.type === 'tag' && authorNodePrev.name === 'a' && authorNodePrev.attribs.href && authorNodePrev.attribs.href.startsWith('?q=%23')) {
|
|
71
|
+
// authorNode 前一个节点是链接, 且是个 hashtag,表示启用了 efb-patch-middleware,这个节点是公众号名
|
|
72
|
+
// 有两种可能:
|
|
73
|
+
// 带 # 的完整公众号名 (efb-patch-middleware 启用,且 hashtag 完全合法)
|
|
74
|
+
// 被截断的公众号名前半部分 (efb-patch-middleware 启用,但 hashtag 被空格或标点截断)
|
|
75
|
+
// (若 efb-patch-middleware 未启用,或 hashtag 完全不合法,不会进入此流程)
|
|
76
|
+
titleElemIs3thA = true;
|
|
77
|
+
author += $(authorNodePrev).text();
|
|
78
|
+
}
|
|
31
79
|
|
|
32
|
-
|
|
80
|
+
const spaceIndex = authorNode.data.indexOf(' ');
|
|
81
|
+
const colonIndex = authorNode.data.indexOf(':');
|
|
82
|
+
if (authorNode.data.length > 1 && colonIndex !== -1 && (spaceIndex !== -1 || titleElemIs3thA)) {
|
|
83
|
+
// 有三种可能:
|
|
84
|
+
// 不带 # 的完整公众号名 (efb-patch-middleware 未启用)
|
|
85
|
+
// 带 # 的完整公众号名 (efb-patch-middleware 启用,但 hashtag 完全不合法)
|
|
86
|
+
// 被截断的公众号名后半部分 (efb-patch-middleware 启用,但 hashtag 被空格或标点截断,此时空格有意义)
|
|
87
|
+
// (若 efb-patch-middleware 启用,且 hashtag 完全合法,不会进入此流程)
|
|
88
|
+
const sliceStart = titleElemIs3thA ? 0 : spaceIndex + 1;
|
|
89
|
+
author += authorNode.data.slice(sliceStart, colonIndex); // 提取作者
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (author.startsWith('#')) {
|
|
93
|
+
author = author.slice(1); // 去掉开头的 #
|
|
94
|
+
}
|
|
95
|
+
}
|
|
33
96
|
|
|
34
|
-
|
|
35
|
-
|
|
97
|
+
// 如果启用了 efb-patch-middleware 且 hashtag (部分)合法,第三个 a 元素会是文章链接,否则是第二个
|
|
98
|
+
const titleElemNth = titleElemIs3thA ? 3 : 2;
|
|
99
|
+
const titleElem = item.find(`.tgme_widget_message_text > a:nth-of-type(${titleElemNth})`);
|
|
100
|
+
|
|
101
|
+
if (titleElem.length === 0) {
|
|
102
|
+
// 获取不到标题 a 元素,这可能是公众号发的服务消息,丢弃它
|
|
36
103
|
return;
|
|
37
104
|
}
|
|
38
105
|
|
|
39
|
-
let
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
if (
|
|
46
|
-
//
|
|
47
|
-
|
|
48
|
-
const colonIndex = author_node.data.indexOf(':');
|
|
49
|
-
if (spaceIndex !== -1 && colonIndex !== -1) {
|
|
50
|
-
// 找到了公众号名,说明这个频道订阅了多个公众号
|
|
51
|
-
author = author_node.data.slice(spaceIndex + 1, colonIndex); // 提取作者
|
|
52
|
-
if (mpName && author !== mpName) {
|
|
53
|
-
// 指定了要筛选的公众号名,且该文章不是该公众号发的
|
|
54
|
-
return; // 丢弃
|
|
55
|
-
} else if (!mpName) {
|
|
56
|
-
// 没有指定要筛选的公众号名
|
|
57
|
-
title = author + ': ' + title; // 给标题里加上获取到的作者
|
|
58
|
-
}
|
|
59
|
-
}
|
|
106
|
+
let title = titleElem.text();
|
|
107
|
+
const link = titleElem.attr('href');
|
|
108
|
+
|
|
109
|
+
if (mpName && author !== mpName) {
|
|
110
|
+
// 指定了要筛选的公众号名,且该文章不是该公众号发的
|
|
111
|
+
return; // 丢弃
|
|
112
|
+
} else if (!mpName && author) {
|
|
113
|
+
// 没有指定要筛选的公众号名,且匹配到了作者
|
|
114
|
+
title = author + ': ' + title; // 给标题里加上获取到的作者
|
|
60
115
|
}
|
|
61
116
|
|
|
62
117
|
const pubDate = new Date(item.find('.tgme_widget_message_date time').attr('datetime')).toUTCString();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const got = require('@/utils/got');
|
|
2
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
2
3
|
|
|
3
4
|
module.exports = async (ctx) => {
|
|
4
5
|
const motifUrl = `https://36kr.com/motif/${ctx.params.mid}`;
|
|
@@ -13,7 +14,7 @@ module.exports = async (ctx) => {
|
|
|
13
14
|
const articleList = motifArticleList.map((item) => ({
|
|
14
15
|
title: item.templateMaterial.widgetTitle,
|
|
15
16
|
link: `https://36kr.com/${item.route.split('?')[0] === 'detail_video' ? 'video' : 'p'}/${item.itemId}`,
|
|
16
|
-
pubDate:
|
|
17
|
+
pubDate: parseDate(item.templateMaterial.publishTime),
|
|
17
18
|
}));
|
|
18
19
|
|
|
19
20
|
ctx.state.data = {
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
const cheerio = require('cheerio');
|
|
3
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
4
|
+
|
|
5
|
+
const links = {
|
|
6
|
+
latest: 'information/web_news',
|
|
7
|
+
recommend: 'information/web_recommend',
|
|
8
|
+
life: 'information/happy_life',
|
|
9
|
+
estate: 'information/real_estate',
|
|
10
|
+
workplace: 'information/web_zhichang',
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
module.exports = async (ctx) => {
|
|
14
|
+
const category = ctx.params.category ?? 'latest';
|
|
15
|
+
|
|
16
|
+
const rootUrl = 'https://36kr.com';
|
|
17
|
+
const currentUrl = `${rootUrl}/${links.hasOwnProperty(category) ? links[category] : `information/${category}`}`;
|
|
18
|
+
|
|
19
|
+
const response = await got({
|
|
20
|
+
method: 'get',
|
|
21
|
+
url: currentUrl,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const data = JSON.parse(response.data.match(/<script>window\.initialState=(.*?)<\/script>/)[1]);
|
|
25
|
+
|
|
26
|
+
const list = data.information.informationList.itemList
|
|
27
|
+
.filter((item) => item.itemType === 10)
|
|
28
|
+
.map((item) => ({
|
|
29
|
+
title: item.templateMaterial.widgetTitle,
|
|
30
|
+
link: `${rootUrl}/p/${item.itemId} `,
|
|
31
|
+
pubDate: parseDate(item.templateMaterial.publishTime),
|
|
32
|
+
}));
|
|
33
|
+
|
|
34
|
+
const items = await Promise.all(
|
|
35
|
+
list.map((item) =>
|
|
36
|
+
ctx.cache.tryGet(item.link, async () => {
|
|
37
|
+
const detailResponse = await got({
|
|
38
|
+
method: 'get',
|
|
39
|
+
url: item.link,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const content = cheerio.load(detailResponse.data);
|
|
43
|
+
|
|
44
|
+
item.description = content('.articleDetailContent').html();
|
|
45
|
+
|
|
46
|
+
return item;
|
|
47
|
+
})
|
|
48
|
+
)
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
ctx.state.data = {
|
|
52
|
+
title: `${response.data.match(/shareTitle: "(.*)频道.*",/)[1]} - 36氪资讯`,
|
|
53
|
+
link: currentUrl,
|
|
54
|
+
item: items,
|
|
55
|
+
};
|
|
56
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const got = require('@/utils/got');
|
|
2
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
2
3
|
|
|
3
4
|
module.exports = async (ctx) => {
|
|
4
5
|
const response = await got({
|
|
@@ -21,7 +22,7 @@ module.exports = async (ctx) => {
|
|
|
21
22
|
const single = {
|
|
22
23
|
title,
|
|
23
24
|
link,
|
|
24
|
-
pubDate:
|
|
25
|
+
pubDate: parseDate(date),
|
|
25
26
|
description,
|
|
26
27
|
};
|
|
27
28
|
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
'36kr.com': {
|
|
3
|
+
_name: '36kr',
|
|
4
|
+
'.': [
|
|
5
|
+
{
|
|
6
|
+
title: '资讯',
|
|
7
|
+
docs: 'https://docs.rsshub.app/new-media.html#_36kr',
|
|
8
|
+
source: '/',
|
|
9
|
+
target: '/36kr/news',
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
title: '快讯',
|
|
13
|
+
docs: 'https://docs.rsshub.app/new-media.html#_36kr',
|
|
14
|
+
source: '/',
|
|
15
|
+
target: '/36kr/newsflashes',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
title: '用户文章',
|
|
19
|
+
docs: 'https://docs.rsshub.app/new-media.html#_36kr',
|
|
20
|
+
source: '/user/:uid',
|
|
21
|
+
target: '/36kr/user/:uid',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
title: '主题文章',
|
|
25
|
+
docs: 'https://docs.rsshub.app/new-media.html#_36kr',
|
|
26
|
+
source: '/motif/:mid',
|
|
27
|
+
target: '/36kr/motif/:mid',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
title: '搜索文章',
|
|
31
|
+
docs: 'https://docs.rsshub.app/new-media.html#_36kr',
|
|
32
|
+
source: '/search/articles/:keyword',
|
|
33
|
+
target: '/36kr/search/article/:keyword',
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
module.exports = (router) => {
|
|
2
|
+
router.get('/motif/:mid', require('./motif'));
|
|
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/:uid', require('./user'));
|
|
7
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const got = require('@/utils/got');
|
|
2
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
2
3
|
|
|
3
4
|
module.exports = async (ctx) => {
|
|
4
5
|
const { keyword = '' } = ctx.params;
|
|
@@ -53,11 +54,11 @@ module.exports = async (ctx) => {
|
|
|
53
54
|
const single = {
|
|
54
55
|
title: item.widgetTitle,
|
|
55
56
|
link,
|
|
56
|
-
pubDate:
|
|
57
|
+
pubDate: parseDate(item.publishTime),
|
|
57
58
|
};
|
|
58
59
|
|
|
59
60
|
const other = await ctx.cache.tryGet(link, () => load(link));
|
|
60
|
-
return
|
|
61
|
+
return { ...single, ...other };
|
|
61
62
|
})
|
|
62
63
|
);
|
|
63
64
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const got = require('@/utils/got');
|
|
2
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
2
3
|
|
|
3
4
|
module.exports = async (ctx) => {
|
|
4
5
|
const userUrl = `https://36kr.com/user/${ctx.params.uid}`;
|
|
@@ -13,7 +14,7 @@ module.exports = async (ctx) => {
|
|
|
13
14
|
const articleList = authorFlowList.map((item) => ({
|
|
14
15
|
title: item.templateMaterial.widgetTitle,
|
|
15
16
|
link: `https://36kr.com/${item.route.split('?')[0] === 'detail_video' ? 'video' : 'p'}/${item.itemId}`,
|
|
16
|
-
pubDate:
|
|
17
|
+
pubDate: parseDate(item.templateMaterial.publishTime),
|
|
17
18
|
}));
|
|
18
19
|
|
|
19
20
|
ctx.state.data = {
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const got = require('@/utils/got');
|
|
3
|
+
const cheerio = require('cheerio');
|
|
4
|
+
const { art } = require('@/utils/render');
|
|
5
|
+
const timezone = require('@/utils/timezone');
|
|
6
|
+
|
|
7
|
+
module.exports = async (ctx) => {
|
|
8
|
+
const response = await got({
|
|
9
|
+
method: 'get',
|
|
10
|
+
url: 'https://www.abskoop.com/archives/',
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const $list = cheerio.load(response.data);
|
|
14
|
+
const list = $list('article li')
|
|
15
|
+
.slice(0, 20)
|
|
16
|
+
.map(function () {
|
|
17
|
+
return {
|
|
18
|
+
link: $list(this).find('a').attr('href'),
|
|
19
|
+
};
|
|
20
|
+
})
|
|
21
|
+
.get();
|
|
22
|
+
|
|
23
|
+
const items = await Promise.all(
|
|
24
|
+
list.map((item) =>
|
|
25
|
+
ctx.cache.tryGet(item.link, async () => {
|
|
26
|
+
const detailResponse = await got({ method: 'get', url: item.link });
|
|
27
|
+
const $detail = cheerio.load(detailResponse.data);
|
|
28
|
+
$detail('article .entry-content a').each(function () {
|
|
29
|
+
if ($detail(this).find('img').length > 0) {
|
|
30
|
+
$detail(this).replaceWith(`<img src=${$detail(this).attr('href')}>`);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
const desc = [];
|
|
34
|
+
$detail('article .entry-content > p').each(function () {
|
|
35
|
+
desc.push($detail(this).html());
|
|
36
|
+
});
|
|
37
|
+
item.title = $detail('article h1.entry-title').text();
|
|
38
|
+
item.description = art(path.join(__dirname, 'templates/description.art'), { desc });
|
|
39
|
+
item.pubDate = timezone($detail('article time').attr('datetime'), -8);
|
|
40
|
+
return item;
|
|
41
|
+
})
|
|
42
|
+
)
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
ctx.state.data = {
|
|
46
|
+
title: 'ahhhhfs - A姐分享',
|
|
47
|
+
link: 'https://www.abskoop.com',
|
|
48
|
+
description:
|
|
49
|
+
'A姐分享,分享各种网络云盘资源、BT种子、高清电影电视剧和羊毛福利,收集各种有趣实用的软件和APP的下载、安装、使用方法,发现一些稀奇古怪的的网站,折腾一些有趣实用的教程,关注谷歌苹果等互联网最新的资讯动态,探索新领域,发现新美好,分享小快乐。',
|
|
50
|
+
item: items,
|
|
51
|
+
};
|
|
52
|
+
};
|
|
@@ -2,7 +2,7 @@ const querystring = require('querystring');
|
|
|
2
2
|
const cheerio = require('cheerio');
|
|
3
3
|
const got = require('@/utils/got');
|
|
4
4
|
const torrent = require('@/utils/torrent');
|
|
5
|
-
|
|
5
|
+
const config = require('@/config').value;
|
|
6
6
|
module.exports = async (ctx) => {
|
|
7
7
|
const userid = ctx.params.userid;
|
|
8
8
|
const routeParams = querystring.parse(ctx.params.routeParams);
|
|
@@ -25,6 +25,7 @@ module.exports = async (ctx) => {
|
|
|
25
25
|
url,
|
|
26
26
|
headers: {
|
|
27
27
|
Referer: url,
|
|
28
|
+
Cookie: config.douban.cookie || '',
|
|
28
29
|
},
|
|
29
30
|
}).then((response) => {
|
|
30
31
|
const data = response.data;
|
|
@@ -0,0 +1,67 @@
|
|
|
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 ?? 'all';
|
|
8
|
+
const language = ctx.params.language ?? 'e';
|
|
9
|
+
|
|
10
|
+
const rootUrl = 'http://world.kbs.co.kr';
|
|
11
|
+
const currentUrl = `${rootUrl}/service/news_list.htm?lang=${language}${category === 'all' ? '' : `&id=${category}`}`;
|
|
12
|
+
|
|
13
|
+
const response = await got({
|
|
14
|
+
method: 'get',
|
|
15
|
+
url: currentUrl,
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const $ = cheerio.load(response.data);
|
|
19
|
+
|
|
20
|
+
$('.comp_pagination').remove();
|
|
21
|
+
|
|
22
|
+
const list = $('.comp_contents_1x article')
|
|
23
|
+
.map((_, item) => {
|
|
24
|
+
item = $(item);
|
|
25
|
+
|
|
26
|
+
const a = item.find('h2 a');
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
title: a.text(),
|
|
30
|
+
category: item.find('.cate').text(),
|
|
31
|
+
link: `${rootUrl}/service${a.attr('href').replace('./', '/')}`,
|
|
32
|
+
pubDate: timezone(
|
|
33
|
+
parseDate(
|
|
34
|
+
item
|
|
35
|
+
.find('.date')
|
|
36
|
+
.text()
|
|
37
|
+
.match(/(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})/)[1]
|
|
38
|
+
),
|
|
39
|
+
+9
|
|
40
|
+
),
|
|
41
|
+
};
|
|
42
|
+
})
|
|
43
|
+
.get();
|
|
44
|
+
|
|
45
|
+
const items = await Promise.all(
|
|
46
|
+
list.map((item) =>
|
|
47
|
+
ctx.cache.tryGet(item.link, async () => {
|
|
48
|
+
const detailResponse = await got({
|
|
49
|
+
method: 'get',
|
|
50
|
+
url: item.link,
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const content = cheerio.load(detailResponse.data);
|
|
54
|
+
|
|
55
|
+
item.description = content('.body_txt').html();
|
|
56
|
+
|
|
57
|
+
return item;
|
|
58
|
+
})
|
|
59
|
+
)
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
ctx.state.data = {
|
|
63
|
+
title: `${$('.active').text() || list[0].category} - KBS WORLD`,
|
|
64
|
+
link: currentUrl,
|
|
65
|
+
item: items,
|
|
66
|
+
};
|
|
67
|
+
};
|