rsshub 1.0.0-master.b08045c → 1.0.0-master.b08abca
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 +2 -2
- package/lib/app.js +2 -2
- package/lib/config.js +1 -0
- package/lib/radar-rules.js +0 -17
- package/lib/radar.js +1 -1
- package/lib/router.js +26 -29
- package/lib/utils/logger.js +14 -2
- package/lib/v2/8264/list.js +92 -0
- package/lib/v2/8264/maintainer.js +3 -0
- package/lib/v2/8264/radar.js +355 -0
- package/lib/v2/8264/router.js +3 -0
- package/lib/v2/8264/templates/description.art +5 -0
- package/lib/v2/abskoop/index.js +21 -31
- package/lib/v2/abskoop/nsfw.js +16 -37
- package/lib/v2/abskoop/radar.js +13 -2
- package/lib/v2/ainvest/article.js +42 -0
- package/lib/v2/ainvest/maintainer.js +4 -0
- package/lib/v2/ainvest/news.js +39 -0
- package/lib/v2/ainvest/radar.js +19 -0
- package/lib/v2/ainvest/router.js +4 -0
- package/lib/v2/ainvest/utils.js +73 -0
- package/lib/v2/alternativeto/maintainer.js +4 -0
- package/lib/v2/alternativeto/platform.js +32 -0
- package/lib/v2/alternativeto/radar.js +19 -0
- package/lib/v2/alternativeto/router.js +4 -0
- package/lib/v2/alternativeto/software.js +32 -0
- package/lib/v2/alternativeto/utils.js +22 -0
- package/lib/v2/apnews/topics.js +1 -0
- package/lib/v2/baidu/maintainer.js +1 -0
- package/lib/v2/baidu/radar.js +15 -1
- package/lib/v2/baidu/router.js +1 -0
- package/lib/v2/baidu/templates/tieba_search.art +1 -0
- package/lib/v2/baidu/tieba/search.js +63 -0
- package/lib/v2/bangumi/maintainer.js +1 -0
- package/lib/v2/bangumi/radar.js +9 -9
- package/lib/v2/bangumi/router.js +1 -2
- package/lib/v2/bangumi/tv/subject/ep.js +4 -3
- package/lib/v2/bangumi/tv/subject/index.js +18 -16
- package/lib/v2/bangumi/tv/subject/offcial-subject-api.js +3 -2
- package/lib/v2/bangumi/tv/subject/utils.js +5 -0
- package/lib/{routes → v2}/bbc/index.js +4 -4
- package/lib/v2/bbc/maintainer.js +4 -0
- package/lib/v2/bbc/radar.js +11 -0
- package/lib/v2/bbc/router.js +3 -0
- package/lib/v2/bilibili/dynamic.js +26 -12
- package/lib/v2/bilibili/followings_dynamic.js +1 -1
- package/lib/v2/bilibili/maintainer.js +2 -1
- package/lib/v2/bilibili/router.js +1 -0
- package/lib/v2/bilibili/utils.js +3 -1
- package/lib/v2/bilibili/watchlater.js +44 -0
- package/lib/v2/bjfu/grs.js +22 -36
- package/lib/v2/bjfu/it/index.js +9 -7
- package/lib/v2/bjfu/it/utils.js +38 -29
- package/lib/v2/bjfu/jwc/index.js +3 -8
- package/lib/v2/bjfu/jwc/utils.js +26 -29
- package/lib/v2/bjfu/kjc.js +25 -38
- package/lib/v2/bjfu/news/index.js +12 -9
- package/lib/v2/bjfu/news/utils.js +17 -19
- package/lib/v2/boc/maintainer.js +3 -0
- package/lib/v2/boc/radar.js +13 -0
- package/lib/v2/boc/router.js +3 -0
- package/lib/{routes → v2}/boc/whpj.js +16 -15
- package/lib/{routes → v2}/caus/index.js +7 -6
- package/lib/v2/caus/maintainer.js +3 -0
- package/lib/v2/caus/radar.js +13 -0
- package/lib/v2/caus/router.js +3 -0
- package/lib/v2/cbc/maintainer.js +3 -0
- package/lib/v2/cbc/radar.js +13 -0
- package/lib/v2/cbc/router.js +3 -0
- package/lib/{routes → v2}/cbc/topics.js +11 -26
- package/lib/v2/chinawriter/index.js +88 -0
- package/lib/v2/chinawriter/maintainer.js +3 -0
- package/lib/v2/chinawriter/radar.js +660 -0
- package/lib/v2/chinawriter/router.js +3 -0
- package/lib/v2/cna/index.js +63 -0
- package/lib/v2/cna/maintainer.js +3 -0
- package/lib/v2/cna/radar.js +13 -0
- package/lib/v2/cna/router.js +3 -0
- package/lib/v2/cyzone/author.js +20 -0
- package/lib/v2/cyzone/index.js +27 -0
- package/lib/v2/cyzone/label.js +20 -0
- package/lib/v2/cyzone/maintainer.js +7 -0
- package/lib/v2/cyzone/radar.js +25 -0
- package/lib/v2/cyzone/router.js +6 -0
- package/lib/v2/cyzone/util.js +125 -0
- package/lib/v2/deltaio/blog.js +33 -0
- package/lib/v2/deltaio/maintainer.js +3 -0
- package/lib/v2/deltaio/radar.js +13 -0
- package/lib/v2/deltaio/router.js +3 -0
- package/lib/v2/discourse/maintainer.js +1 -1
- package/lib/v2/discourse/notifications.js +19 -2
- package/lib/v2/discourse/router.js +1 -1
- package/lib/v2/discuz/discuz.js +156 -0
- package/lib/v2/discuz/maintainer.js +5 -0
- package/lib/v2/discuz/radar.js +0 -0
- package/lib/v2/discuz/router.js +5 -0
- package/lib/v2/dn/maintainer.js +3 -0
- package/lib/v2/dn/news.js +90 -0
- package/lib/v2/dn/radar.js +55 -0
- package/lib/v2/dn/router.js +3 -0
- package/lib/v2/dn/templates/description.art +15 -0
- package/lib/v2/domp4/detail.js +4 -2
- package/lib/v2/domp4/latest.js +7 -4
- package/lib/v2/domp4/utils.js +15 -2
- package/lib/v2/dorohedoro/news.js +3 -1
- package/lib/v2/douyin/live.js +45 -15
- package/lib/v2/dribbble/maintainer.js +5 -0
- package/lib/v2/dribbble/radar.js +25 -0
- package/lib/v2/dribbble/router.js +5 -0
- package/lib/v2/dribbble/templates/description.art +15 -0
- package/lib/v2/dribbble/utils.js +156 -0
- package/lib/v2/fantia/user.js +16 -0
- package/lib/v2/gamegene/maintainer.js +3 -0
- package/lib/v2/gamegene/news.js +50 -0
- package/lib/v2/gamegene/radar.js +13 -0
- package/lib/v2/gamegene/router.js +3 -0
- package/lib/v2/github/maintainer.js +1 -0
- package/lib/v2/github/pulse.js +87 -0
- package/lib/v2/github/radar.js +6 -0
- package/lib/v2/github/router.js +1 -0
- package/lib/v2/github/templates/pulse-description.art +24 -0
- package/lib/v2/gov/maintainer.js +1 -0
- package/lib/v2/gov/radar.js +8 -0
- package/lib/v2/gov/router.js +1 -0
- package/lib/v2/gov/shenzhen/zjj/index.js +45 -0
- package/lib/v2/hrbeu/radar.js +3 -3
- package/lib/v2/hrbeu/router.js +1 -1
- package/lib/v2/hrbeu/uae/news.js +66 -0
- package/lib/v2/icbc/maintainer.js +3 -0
- package/lib/v2/icbc/radar.js +13 -0
- package/lib/v2/icbc/router.js +3 -0
- package/lib/v2/icbc/whpj.js +57 -0
- package/lib/v2/iqiyi/maintainer.js +1 -1
- package/lib/v2/iqiyi/video.js +42 -33
- package/lib/v2/ithome/tag.js +14 -3
- package/lib/v2/japanpost/maintainer.js +3 -0
- package/lib/v2/japanpost/radar.js +22 -0
- package/lib/v2/japanpost/router.js +3 -0
- package/lib/v2/japanpost/templates/track_item_desc.art +14 -0
- package/lib/{routes → v2}/japanpost/track.js +32 -29
- package/lib/{routes → v2}/japanpost/utils.js +10 -11
- package/lib/v2/kamen-rider-official/maintainer.js +3 -0
- package/lib/v2/kamen-rider-official/news.js +110 -0
- package/lib/v2/kamen-rider-official/radar.js +18 -0
- package/lib/v2/kamen-rider-official/router.js +3 -0
- package/lib/v2/kamen-rider-official/templates/description.art +10 -0
- package/lib/v2/kantarworldpanel/index.js +96 -0
- package/lib/v2/kantarworldpanel/maintainer.js +3 -0
- package/lib/v2/kantarworldpanel/radar.js +199 -0
- package/lib/v2/kantarworldpanel/router.js +3 -0
- package/lib/v2/kantarworldpanel/templates/description.art +9 -0
- package/lib/v2/kunchengblog/essay.js +35 -19
- package/lib/v2/kunchengblog/radar.js +1 -1
- package/lib/v2/kunchengblog/router.js +1 -1
- package/lib/v2/latepost/index.js +2 -2
- package/lib/v2/latepost/radar.js +1 -1
- package/lib/v2/lemmy/index.js +61 -0
- package/lib/v2/lemmy/maintainer.js +3 -0
- package/lib/v2/lemmy/router.js +3 -0
- package/lib/v2/liulinblog/index.js +98 -0
- package/lib/v2/liulinblog/maintainer.js +6 -2
- package/lib/v2/liulinblog/radar.js +39 -19
- package/lib/v2/liulinblog/router.js +7 -3
- package/lib/v2/lsnu/jiaowc/tzgg.js +52 -0
- package/lib/v2/lsnu/maintainer.js +3 -0
- package/lib/v2/lsnu/radar.js +13 -0
- package/lib/v2/lsnu/router.js +3 -0
- package/lib/v2/luxiangdong/archive.js +28 -0
- package/lib/v2/luxiangdong/maintainer.js +3 -0
- package/lib/v2/luxiangdong/radar.js +13 -0
- package/lib/v2/luxiangdong/router.js +3 -0
- package/lib/v2/mail/imap.js +99 -0
- package/lib/v2/mail/maintainer.js +3 -0
- package/lib/v2/mail/router.js +3 -0
- package/lib/v2/mihoyo/bbs/img-ranking.js +106 -0
- package/lib/v2/mihoyo/{bbs.js → bbs/official.js} +1 -1
- package/lib/v2/mihoyo/bbs/static-data.js +137 -0
- package/lib/v2/mihoyo/maintainer.js +1 -0
- package/lib/v2/mihoyo/radar.js +7 -1
- package/lib/v2/mihoyo/router.js +2 -1
- package/lib/v2/mixcloud/index.js +5 -22
- package/lib/v2/mixcloud/queries.js +187 -179
- package/lib/v2/mydrivers/cid.js +38 -0
- package/lib/v2/mydrivers/index.js +40 -89
- package/lib/v2/mydrivers/maintainer.js +5 -1
- package/lib/v2/mydrivers/radar.js +205 -4
- package/lib/v2/mydrivers/rank.js +40 -0
- package/lib/v2/mydrivers/router.js +4 -1
- package/lib/v2/mydrivers/templates/description.art +5 -0
- package/lib/v2/mydrivers/util.js +125 -0
- package/lib/v2/news/whxw.js +1 -0
- package/lib/v2/nytimes/index.js +1 -4
- package/lib/v2/nytimes/utils.js +5 -0
- package/lib/v2/pornhub/category.js +44 -0
- package/lib/v2/pornhub/category_url.js +25 -0
- package/lib/v2/pornhub/maintainer.js +8 -0
- package/lib/v2/pornhub/model.js +29 -0
- package/lib/v2/pornhub/pornstar.js +29 -0
- package/lib/v2/pornhub/radar.js +46 -0
- package/lib/v2/pornhub/router.js +8 -0
- package/lib/v2/pornhub/search.js +23 -0
- package/lib/v2/pornhub/templates/description.art +11 -0
- package/lib/v2/pornhub/users.js +30 -0
- package/lib/v2/pornhub/utils.js +30 -0
- package/lib/v2/reuters/common.js +52 -26
- package/lib/v2/rfi/maintainer.js +1 -1
- package/lib/v2/rfi/news.js +9 -2
- package/lib/v2/rfi/router.js +1 -1
- package/lib/v2/rsc/journal.js +106 -0
- package/lib/v2/rsc/maintainer.js +3 -0
- package/lib/v2/rsc/radar.js +23 -0
- package/lib/v2/rsc/router.js +3 -0
- package/lib/v2/rsc/templates/image.art +5 -0
- package/lib/v2/rsshub/maintainer.js +1 -0
- package/lib/v2/rsshub/router.js +1 -0
- package/lib/v2/rsshub/routes.js +6 -4
- package/lib/v2/rsshub/transform/html.js +9 -0
- package/lib/v2/rsshub/transform/json.js +1 -0
- package/lib/v2/rsshub/transform/sitemap.js +52 -0
- package/lib/v2/scut/maintainer.js +1 -0
- package/lib/v2/scut/radar.js +34 -0
- package/lib/v2/scut/router.js +1 -0
- package/lib/v2/scut/smae/notice.js +54 -0
- package/lib/v2/sqmc/maintainer.js +3 -0
- package/lib/v2/sqmc/radar.js +13 -0
- package/lib/v2/sqmc/router.js +3 -0
- package/lib/v2/sqmc/www.js +49 -0
- package/lib/v2/stheadline/std/realtime.js +8 -6
- package/lib/v2/stockedge/daily-news.js +1 -1
- package/lib/v2/stockedge/utils.js +1 -0
- package/lib/v2/test/index.js +1 -1
- package/lib/v2/tfc-taiwan/index.js +36 -0
- package/lib/v2/tfc-taiwan/maintainer.js +10 -0
- package/lib/v2/tfc-taiwan/radar.js +31 -0
- package/lib/v2/tfc-taiwan/router.js +7 -0
- package/lib/v2/tfc-taiwan/templates/article.art +7 -0
- package/lib/v2/tfc-taiwan/utils.js +56 -0
- package/lib/v2/thepaper/utils.js +1 -1
- package/lib/v2/toodaylab/index.js +99 -0
- package/lib/v2/toodaylab/maintainer.js +7 -0
- package/lib/v2/toodaylab/radar.js +37 -0
- package/lib/v2/toodaylab/router.js +3 -0
- package/lib/v2/udn/breaking-news.js +10 -5
- package/lib/v2/ustc/eeis.js +5 -4
- package/lib/v2/ustc/sist.js +6 -5
- package/lib/v2/v2ex/maintainer.js +5 -0
- package/lib/v2/v2ex/post.js +35 -0
- package/lib/v2/v2ex/radar.js +35 -0
- package/lib/v2/v2ex/router.js +5 -0
- package/lib/{routes → v2}/v2ex/tab.js +17 -21
- package/lib/{routes → v2}/v2ex/topics.js +1 -1
- package/lib/v2/whu/cs.js +71 -0
- package/lib/v2/whu/gs/index.js +85 -0
- package/lib/v2/whu/maintainer.js +5 -0
- package/lib/v2/whu/news.js +102 -0
- package/lib/v2/whu/radar.js +27 -0
- package/lib/v2/whu/router.js +5 -0
- package/lib/v2/xinpianchang/index.js +19 -0
- package/lib/v2/xinpianchang/maintainer.js +4 -0
- package/lib/v2/xinpianchang/radar.js +28 -0
- package/lib/v2/xinpianchang/rank.js +33 -0
- package/lib/v2/xinpianchang/router.js +5 -0
- package/lib/v2/xinpianchang/templates/description.art +13 -0
- package/lib/v2/xinpianchang/util.js +110 -0
- package/lib/v2/xmut/jwc/bkjw.js +62 -0
- package/lib/v2/xmut/jwc/yjs.js +51 -0
- package/lib/v2/xmut/maintainer.js +3 -0
- package/lib/v2/xmut/radar.js +13 -0
- package/lib/v2/xmut/router.js +4 -0
- package/lib/v2/zodgame/forum.js +61 -23
- package/lib/v2/zodgame/templates/forum.art +1 -1
- package/lib/views/welcome.art +1 -1
- package/package.json +46 -17
- package/lib/routes/cna/index.js +0 -54
- package/lib/routes/cyzone/author.js +0 -55
- package/lib/routes/cyzone/label.js +0 -53
- package/lib/routes/discuz/discuz.js +0 -148
- package/lib/routes/dribbble/utils.js +0 -94
- package/lib/routes/kkj/news.js +0 -52
- package/lib/routes/mail/imap.js +0 -79
- package/lib/routes/pornhub/category.js +0 -22
- package/lib/routes/pornhub/category_url.js +0 -34
- package/lib/routes/pornhub/model.js +0 -35
- package/lib/routes/pornhub/pornstar.js +0 -35
- package/lib/routes/pornhub/search.js +0 -22
- package/lib/routes/pornhub/users.js +0 -35
- package/lib/routes/universities/whu/cs.js +0 -38
- package/lib/routes/universities/whu/news.js +0 -128
- package/lib/routes/v2ex/post.js +0 -39
- package/lib/v2/abskoop/templates/description.art +0 -3
- package/lib/v2/hrbeu/uae/list.js +0 -57
- package/lib/v2/liulinblog/itnews.js +0 -23
- package/lib/v2/liulinblog/kuaixun.js +0 -17
- package/lib/v2/liulinblog/utils.js +0 -42
- /package/lib/{routes → v2}/bbc/utils.js +0 -0
- /package/lib/{routes → v2}/dribbble/keyword.js +0 -0
- /package/lib/{routes → v2}/dribbble/popular.js +0 -0
- /package/lib/{routes → v2}/dribbble/user.js +0 -0
|
@@ -3,7 +3,6 @@ const JSONbig = require('json-bigint');
|
|
|
3
3
|
const utils = require('./utils');
|
|
4
4
|
const { parseDate } = require('@/utils/parse-date');
|
|
5
5
|
const { fallback, queryToBoolean } = require('@/utils/readable-social');
|
|
6
|
-
const querystring = require('querystring');
|
|
7
6
|
const cache = require('./cache');
|
|
8
7
|
|
|
9
8
|
/**
|
|
@@ -69,11 +68,12 @@ const cache = require('./cache');
|
|
|
69
68
|
|
|
70
69
|
module.exports = async (ctx) => {
|
|
71
70
|
const uid = ctx.params.uid;
|
|
72
|
-
const routeParams =
|
|
73
|
-
|
|
71
|
+
const routeParams = Object.fromEntries(new URLSearchParams(ctx.params.routeParams));
|
|
74
72
|
const showEmoji = fallback(undefined, queryToBoolean(routeParams.showEmoji), false);
|
|
75
73
|
const disableEmbed = fallback(undefined, queryToBoolean(routeParams.disableEmbed), false);
|
|
76
|
-
const displayArticle =
|
|
74
|
+
const displayArticle = ctx.query.mode === 'fulltext';
|
|
75
|
+
const useAvid = fallback(undefined, queryToBoolean(routeParams.useAvid), false);
|
|
76
|
+
const directLink = fallback(undefined, queryToBoolean(routeParams.directLink), false);
|
|
77
77
|
|
|
78
78
|
const response = await got({
|
|
79
79
|
method: 'get',
|
|
@@ -83,10 +83,16 @@ module.exports = async (ctx) => {
|
|
|
83
83
|
},
|
|
84
84
|
transformResponse: [(data) => data],
|
|
85
85
|
});
|
|
86
|
-
const
|
|
86
|
+
const cards = JSONbig.parse(response.body).data.cards;
|
|
87
|
+
|
|
88
|
+
const usernameAndFace = await cache.getUsernameAndFaceFromUID(ctx, uid);
|
|
89
|
+
const author = usernameAndFace[0] ?? cards[0]?.desc?.user_profile?.info.uname;
|
|
90
|
+
const face = usernameAndFace[1] ?? cards[0]?.desc?.user_profile?.info?.face;
|
|
91
|
+
ctx.cache.set(`bili-username-from-uid-${uid}`, author);
|
|
92
|
+
ctx.cache.set(`bili-userface-from-uid-${uid}`, face);
|
|
87
93
|
|
|
88
94
|
const items = await Promise.all(
|
|
89
|
-
|
|
95
|
+
cards.map(async (item) => {
|
|
90
96
|
const getTitle = (data) => (data ? data.title || data.description || data.content || (data.vest && data.vest.content) || '' : '');
|
|
91
97
|
const getDes = (data) =>
|
|
92
98
|
data.dynamic || data.desc || data.description || data.content || data.summary || (data.vest && data.vest.content) + (data.sketch && `<br>${data.sketch.title}<br>${data.sketch.desc_text}`) || data.intro || '';
|
|
@@ -160,12 +166,12 @@ module.exports = async (ctx) => {
|
|
|
160
166
|
// emoji
|
|
161
167
|
let data_content = getDes(data);
|
|
162
168
|
// 换行处理
|
|
163
|
-
data_content = data_content.replace(
|
|
169
|
+
data_content = data_content.replace(/\r\n/g, '<br>').replace(/\n/g, '<br>');
|
|
164
170
|
if (item.display.emoji_info && showEmoji) {
|
|
165
171
|
const emoji = item.display.emoji_info.emoji_details;
|
|
166
172
|
emoji.forEach((item) => {
|
|
167
173
|
data_content = data_content.replace(
|
|
168
|
-
new RegExp(`\\${item.text}`.replace(
|
|
174
|
+
new RegExp(`\\${item.text}`.replace(/\\?/g, '\\?'), 'g'),
|
|
169
175
|
`<img alt="${item.text}" src="${item.url}"style="margin: -1px 1px 0px; display: inline-block; width: 20px; height: 20px; vertical-align: text-bottom;" title="" referrerpolicy="no-referrer">`
|
|
170
176
|
);
|
|
171
177
|
});
|
|
@@ -176,27 +182,34 @@ module.exports = async (ctx) => {
|
|
|
176
182
|
}
|
|
177
183
|
let url;
|
|
178
184
|
if (data.aid) {
|
|
179
|
-
|
|
185
|
+
const id = useAvid ? `av${data.aid}` : item?.desc?.bvid || item?.desc?.origin?.bvid;
|
|
186
|
+
url = `https://www.bilibili.com/video/${id}`;
|
|
187
|
+
directLink && (link = url);
|
|
180
188
|
return `<br>视频地址:<a href=${url}>${url}</a>`;
|
|
181
189
|
}
|
|
182
190
|
if (data.image_urls) {
|
|
183
191
|
url = `https://www.bilibili.com/read/cv${data.id}`;
|
|
192
|
+
directLink && (link = url);
|
|
184
193
|
return `<br>专栏地址:<a href=${url}>${url}</a>`;
|
|
185
194
|
}
|
|
186
195
|
if (data.upper) {
|
|
187
196
|
url = `https://www.bilibili.com/audio/au${data.id}`;
|
|
197
|
+
directLink && (link = url);
|
|
188
198
|
return `<br>音频地址:<a href=${url}>${url}</a>`;
|
|
189
199
|
}
|
|
190
200
|
if (data.roomid) {
|
|
191
201
|
url = `https://live.bilibili.com/${data.roomid}`;
|
|
202
|
+
directLink && (link = url);
|
|
192
203
|
return `<br>直播间地址:<a href=${url}>${url}</a>`;
|
|
193
204
|
}
|
|
194
205
|
if (data.sketch) {
|
|
195
206
|
url = data.sketch.target_url;
|
|
207
|
+
directLink && (link = url);
|
|
196
208
|
return `<br>活动地址:<a href=${url}>${url}</a>`;
|
|
197
209
|
}
|
|
198
210
|
if (data.url) {
|
|
199
211
|
url = data.url;
|
|
212
|
+
directLink && (link = url);
|
|
200
213
|
return `<br>地址:<a href=${url}>${url}</a>`;
|
|
201
214
|
}
|
|
202
215
|
return '';
|
|
@@ -217,15 +230,16 @@ module.exports = async (ctx) => {
|
|
|
217
230
|
})(),
|
|
218
231
|
pubDate: item.desc?.timestamp ? parseDate(item.desc.timestamp, 'X') : null,
|
|
219
232
|
link,
|
|
233
|
+
author,
|
|
220
234
|
};
|
|
221
235
|
})
|
|
222
236
|
);
|
|
223
237
|
|
|
224
238
|
ctx.state.data = {
|
|
225
|
-
title: `${
|
|
239
|
+
title: `${author} 的 bilibili 动态`,
|
|
226
240
|
link: `https://space.bilibili.com/${uid}/dynamic`,
|
|
227
|
-
description: `${
|
|
228
|
-
image:
|
|
241
|
+
description: `${author} 的 bilibili 动态`,
|
|
242
|
+
image: face,
|
|
229
243
|
item: items,
|
|
230
244
|
};
|
|
231
245
|
};
|
|
@@ -30,7 +30,7 @@ module.exports = {
|
|
|
30
30
|
'/user/channel/:uid/:sid/:disableEmbed?': ['weirongxu'],
|
|
31
31
|
'/user/coin/:uid/:disableEmbed?': ['DIYgod'],
|
|
32
32
|
'/user/collection/:uid/:sid/:disableEmbed?': ['shininome'],
|
|
33
|
-
'/user/dynamic/:uid/:routeParams?': ['DIYgod', 'zytomorrow', 'JimenezLi'],
|
|
33
|
+
'/user/dynamic/:uid/:routeParams?': ['DIYgod', 'zytomorrow', 'CaoMeiYouRen', 'JimenezLi'],
|
|
34
34
|
'/user/fav/:uid/:disableEmbed?': ['DIYgod'],
|
|
35
35
|
'/user/followers/:uid/:loginUid': ['Qixingchen'],
|
|
36
36
|
'/user/followings/:uid/:loginUid': ['Qixingchen'],
|
|
@@ -40,5 +40,6 @@ module.exports = {
|
|
|
40
40
|
'/video/page/:bvid/:disableEmbed?': ['sxzz'],
|
|
41
41
|
'/video/reply/:bvid': ['Qixingchen'],
|
|
42
42
|
'/vsearch/:kw/:order?/:disableEmbed?/:tid?': ['Symty'],
|
|
43
|
+
'/watchlater/:uid/:disableEmbed?': ['JimenezLi'],
|
|
43
44
|
'/weekly/:disableEmbed?': ['ttttmr'],
|
|
44
45
|
};
|
|
@@ -40,5 +40,6 @@ module.exports = (router) => {
|
|
|
40
40
|
router.get('/video/page/:bvid/:disableEmbed?', require('./page'));
|
|
41
41
|
router.get('/video/reply/:bvid', require('./reply'));
|
|
42
42
|
router.get('/vsearch/:kw/:order?/:disableEmbed?/:tid?', require('./vsearch'));
|
|
43
|
+
router.get('/watchlater/:uid/:disableEmbed?', require('./watchlater'));
|
|
43
44
|
router.get('/weekly/:disableEmbed?', require('./weekly_recommend'));
|
|
44
45
|
};
|
package/lib/v2/bilibili/utils.js
CHANGED
|
@@ -7,7 +7,9 @@ function iframe(aid, page, bvid) {
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
const addVerifyInfo = (params, verifyString) => {
|
|
10
|
-
const
|
|
10
|
+
const searchParams = new URLSearchParams(params);
|
|
11
|
+
searchParams.sort();
|
|
12
|
+
const verifyParam = searchParams.toString();
|
|
11
13
|
const wts = Math.round(Date.now() / 1000);
|
|
12
14
|
const w_rid = md5(`${verifyParam}&wts=${wts}${verifyString}`);
|
|
13
15
|
return `${params}&w_rid=${w_rid}&wts=${wts}`;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
const cache = require('./cache');
|
|
3
|
+
const config = require('@/config').value;
|
|
4
|
+
const utils = require('./utils');
|
|
5
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
6
|
+
|
|
7
|
+
module.exports = async (ctx) => {
|
|
8
|
+
const uid = ctx.params.uid;
|
|
9
|
+
const disableEmbed = ctx.params.disableEmbed;
|
|
10
|
+
const name = await cache.getUsernameFromUID(ctx, uid);
|
|
11
|
+
|
|
12
|
+
const cookie = config.bilibili.cookies[uid];
|
|
13
|
+
if (cookie === undefined) {
|
|
14
|
+
throw Error('缺少对应 uid 的 Bilibili 用户登录后的 Cookie 值');
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const response = await got({
|
|
18
|
+
method: 'get',
|
|
19
|
+
url: `https://api.bilibili.com/x/v2/history/toview`,
|
|
20
|
+
headers: {
|
|
21
|
+
Referer: `https://space.bilibili.com/${uid}/`,
|
|
22
|
+
Cookie: cookie,
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
if (response.data.code) {
|
|
26
|
+
const message = response.data.code === -6 ? '对应 uid 的 Bilibili 用户的 Cookie 已过期' : response.data.message;
|
|
27
|
+
throw Error(`Error code ${response.data.code}: ${message}`);
|
|
28
|
+
}
|
|
29
|
+
const list = response.data.data.list;
|
|
30
|
+
|
|
31
|
+
const out = list.map((item) => ({
|
|
32
|
+
title: item.title,
|
|
33
|
+
description: `${item.desc}<br><br><a href="https://www.bilibili.com/list/watchlater?bvid=${item.bvid}">在稍后再看列表中查看</a>${!disableEmbed ? `<br><br>${utils.iframe(item.aid)}` : ''}<br><img src="${item.pic}">`,
|
|
34
|
+
pubDate: parseDate(item.add_at * 1000),
|
|
35
|
+
link: item.pubdate > utils.bvidTime && item.bvid ? `https://www.bilibili.com/video/${item.bvid}` : `https://www.bilibili.com/video/av${item.aid}`,
|
|
36
|
+
author: item.owner.name,
|
|
37
|
+
}));
|
|
38
|
+
|
|
39
|
+
ctx.state.data = {
|
|
40
|
+
title: `${name} 稍后再看`,
|
|
41
|
+
link: 'https://www.bilibili.com/watchlater#/list',
|
|
42
|
+
item: out,
|
|
43
|
+
};
|
|
44
|
+
};
|
package/lib/v2/bjfu/grs.js
CHANGED
|
@@ -1,60 +1,46 @@
|
|
|
1
1
|
const got = require('@/utils/got');
|
|
2
2
|
const cheerio = require('cheerio');
|
|
3
|
-
const
|
|
3
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
4
|
+
const timezone = require('@/utils/timezone');
|
|
4
5
|
|
|
5
6
|
module.exports = async (ctx) => {
|
|
6
7
|
const url = 'http://graduate.bjfu.edu.cn/pygl/pydt/index.html';
|
|
7
|
-
const response = await got.get(url
|
|
8
|
-
|
|
9
|
-
});
|
|
10
|
-
const data = iconv.decode(response.data, 'gb2312');
|
|
8
|
+
const response = await got.get(url);
|
|
9
|
+
const data = response.data;
|
|
11
10
|
const $ = cheerio.load(data);
|
|
12
11
|
const list = $('.itemList li')
|
|
13
|
-
.slice(0,
|
|
14
|
-
.
|
|
12
|
+
.slice(0, 11)
|
|
13
|
+
.toArray()
|
|
14
|
+
.map((e) => {
|
|
15
15
|
const element = $(e);
|
|
16
16
|
const title = element.find('li a').attr('title');
|
|
17
17
|
const link = element.find('li a').attr('href');
|
|
18
|
-
const date =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
);
|
|
24
|
-
const timeZone = 8;
|
|
25
|
-
const serverOffset = date.getTimezoneOffset() / 60;
|
|
26
|
-
const pubDate = new Date(date.getTime() - 60 * 60 * 1000 * (timeZone + serverOffset)).toUTCString();
|
|
18
|
+
const date = element
|
|
19
|
+
.find('li a')
|
|
20
|
+
.text()
|
|
21
|
+
.match(/\d{4}-\d{2}-\d{2}/);
|
|
22
|
+
const pubDate = timezone(parseDate(date), 8);
|
|
27
23
|
|
|
28
24
|
return {
|
|
29
25
|
title,
|
|
30
|
-
description: '',
|
|
31
26
|
link: 'http://graduate.bjfu.edu.cn/pygl/pydt/' + link,
|
|
32
27
|
author: '北京林业大学研究生院培养动态',
|
|
33
28
|
pubDate,
|
|
34
29
|
};
|
|
35
|
-
})
|
|
36
|
-
.get();
|
|
30
|
+
});
|
|
37
31
|
|
|
38
32
|
const result = await Promise.all(
|
|
39
|
-
list.map(
|
|
40
|
-
|
|
33
|
+
list.map((item) =>
|
|
34
|
+
ctx.cache.tryGet(item.link, async () => {
|
|
35
|
+
const itemReponse = await got.get(item.link);
|
|
36
|
+
const data = itemReponse.data;
|
|
37
|
+
const itemElement = cheerio.load(data);
|
|
41
38
|
|
|
42
|
-
|
|
43
|
-
if (cache) {
|
|
44
|
-
return Promise.resolve(JSON.parse(cache));
|
|
45
|
-
}
|
|
39
|
+
item.description = itemElement('.articleTxt').html();
|
|
46
40
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const data = iconv.decode(itemReponse.data, 'gb2312');
|
|
51
|
-
const itemElement = cheerio.load(data);
|
|
52
|
-
|
|
53
|
-
item.description = itemElement('.articleTxt').html();
|
|
54
|
-
|
|
55
|
-
ctx.cache.set(link, JSON.stringify(item));
|
|
56
|
-
return item;
|
|
57
|
-
})
|
|
41
|
+
return item;
|
|
42
|
+
})
|
|
43
|
+
)
|
|
58
44
|
);
|
|
59
45
|
|
|
60
46
|
ctx.state.data = {
|
package/lib/v2/bjfu/it/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const got = require('@/utils/got');
|
|
2
2
|
const cheerio = require('cheerio');
|
|
3
3
|
const util = require('./utils');
|
|
4
|
-
const iconv = require('iconv-lite');
|
|
4
|
+
const iconv = require('iconv-lite');
|
|
5
5
|
|
|
6
6
|
module.exports = async (ctx) => {
|
|
7
7
|
const type = ctx.params.type;
|
|
@@ -27,16 +27,18 @@ module.exports = async (ctx) => {
|
|
|
27
27
|
|
|
28
28
|
const response = await got({
|
|
29
29
|
method: 'get',
|
|
30
|
-
responseType: 'buffer',
|
|
30
|
+
responseType: 'buffer',
|
|
31
31
|
url: base,
|
|
32
32
|
});
|
|
33
33
|
|
|
34
|
-
const data =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
const data = response.data;
|
|
35
|
+
let $ = cheerio.load(iconv.decode(data, 'utf-8'));
|
|
36
|
+
const charset = $('meta[charset]').attr('charset');
|
|
37
|
+
if (charset?.toLowerCase() !== 'utf-8') {
|
|
38
|
+
$ = cheerio.load(iconv.decode(data, charset ?? 'utf-8'));
|
|
39
|
+
}
|
|
38
40
|
|
|
39
|
-
const list = $('.item-content').
|
|
41
|
+
const list = $('.item-content').toArray();
|
|
40
42
|
|
|
41
43
|
const result = await util.ProcessFeed(base, list, ctx.cache); // 感谢@hoilc指导
|
|
42
44
|
|
package/lib/v2/bjfu/it/utils.js
CHANGED
|
@@ -1,62 +1,71 @@
|
|
|
1
1
|
const got = require('@/utils/got');
|
|
2
2
|
const cheerio = require('cheerio');
|
|
3
|
-
const iconv = require('iconv-lite');
|
|
3
|
+
const iconv = require('iconv-lite');
|
|
4
4
|
const { parseDate } = require('@/utils/parse-date');
|
|
5
5
|
const timezone = require('@/utils/timezone');
|
|
6
6
|
|
|
7
7
|
// 完整文章页
|
|
8
8
|
async function load(link) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
let response;
|
|
10
|
+
try {
|
|
11
|
+
response = await got.get(link, {
|
|
12
|
+
responseType: 'buffer',
|
|
13
|
+
});
|
|
14
|
+
} catch (e) {
|
|
15
|
+
return { description: '' };
|
|
16
|
+
}
|
|
12
17
|
|
|
13
|
-
const data =
|
|
18
|
+
const data = response.data; // 不用转码
|
|
14
19
|
|
|
15
20
|
// 加载文章内容
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
$('.template-head-info')
|
|
22
|
-
.text()
|
|
23
|
-
.match(/\d{4}-\d{2}-\d{2}/)
|
|
24
|
-
),
|
|
25
|
-
+8
|
|
26
|
-
);
|
|
21
|
+
let $ = cheerio.load(iconv.decode(data, 'utf-8'));
|
|
22
|
+
const charset = $('meta[charset]').attr('charset');
|
|
23
|
+
if (charset?.toLowerCase() !== 'utf-8') {
|
|
24
|
+
$ = cheerio.load(iconv.decode(data, charset ?? 'utf-8'));
|
|
25
|
+
}
|
|
27
26
|
|
|
28
27
|
// 提取内容
|
|
29
|
-
const description = $('.template-body').html();
|
|
28
|
+
const description = ($('.template-body').length ? $('.template-body').html() : '') + ($('.template-tail').length ? $('.template-tail').html() : '');
|
|
30
29
|
|
|
31
30
|
// 返回解析的结果
|
|
32
|
-
return { description
|
|
31
|
+
return { description };
|
|
33
32
|
}
|
|
34
33
|
|
|
35
34
|
const ProcessFeed = (base, list, caches) =>
|
|
36
35
|
// 使用 Promise.all() 进行 async 并发
|
|
37
36
|
Promise.all(
|
|
38
37
|
// 遍历每一篇文章
|
|
39
|
-
list.map(
|
|
38
|
+
list.map((item) => {
|
|
40
39
|
const $ = cheerio.load(item);
|
|
41
40
|
|
|
42
41
|
const $title = $('a');
|
|
43
42
|
// 还原相对链接为绝对链接
|
|
44
43
|
const itemUrl = new URL($title.attr('href'), base).href; // 感谢@hoilc指导
|
|
45
44
|
|
|
46
|
-
//
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
45
|
+
// 解析日期
|
|
46
|
+
const pubDate = timezone(
|
|
47
|
+
parseDate(
|
|
48
|
+
$('span')
|
|
49
|
+
.text()
|
|
50
|
+
.match(/\d{4}-\d{2}-\d{2}/)
|
|
51
|
+
),
|
|
52
|
+
+8
|
|
53
|
+
);
|
|
53
54
|
|
|
54
55
|
// 使用tryGet方法从缓存获取内容。
|
|
55
56
|
// 当缓存中无法获取到链接内容的时候,则使用load方法加载文章内容。
|
|
56
|
-
|
|
57
|
+
return caches.tryGet(itemUrl, async () => {
|
|
58
|
+
const { description } = await load(itemUrl);
|
|
57
59
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
+
// 列表上提取到的信息
|
|
61
|
+
return {
|
|
62
|
+
title: $title.text(),
|
|
63
|
+
link: itemUrl,
|
|
64
|
+
author: '北林信息',
|
|
65
|
+
description,
|
|
66
|
+
pubDate,
|
|
67
|
+
};
|
|
68
|
+
});
|
|
60
69
|
})
|
|
61
70
|
);
|
|
62
71
|
module.exports = {
|
package/lib/v2/bjfu/jwc/index.js
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
const got = require('@/utils/got');
|
|
2
2
|
const cheerio = require('cheerio');
|
|
3
3
|
const util = require('./utils');
|
|
4
|
-
const iconv = require('iconv-lite'); // 转码
|
|
5
4
|
|
|
6
5
|
module.exports = async (ctx) => {
|
|
7
6
|
const type = ctx.params.type;
|
|
8
7
|
let title, path;
|
|
9
8
|
switch (type) {
|
|
10
|
-
case 'jwkx':
|
|
11
|
-
title = '教务快讯';
|
|
12
|
-
path = 'jwkx/';
|
|
13
|
-
break;
|
|
14
9
|
case 'jgdt':
|
|
15
10
|
title = '教改动态';
|
|
16
11
|
path = 'jgdt/';
|
|
@@ -27,6 +22,7 @@ module.exports = async (ctx) => {
|
|
|
27
22
|
title = '图片新闻';
|
|
28
23
|
path = 'tpxw/';
|
|
29
24
|
break;
|
|
25
|
+
case 'jwkx':
|
|
30
26
|
default:
|
|
31
27
|
title = '教务快讯';
|
|
32
28
|
path = 'jwkx/';
|
|
@@ -35,14 +31,13 @@ module.exports = async (ctx) => {
|
|
|
35
31
|
|
|
36
32
|
const response = await got({
|
|
37
33
|
method: 'get',
|
|
38
|
-
responseType: 'buffer', // 转码
|
|
39
34
|
url: base,
|
|
40
35
|
});
|
|
41
36
|
|
|
42
|
-
const data =
|
|
37
|
+
const data = response.data; // 不用转码
|
|
43
38
|
const $ = cheerio.load(data);
|
|
44
39
|
|
|
45
|
-
const list = $('.list_c li').slice(0,
|
|
40
|
+
const list = $('.list_c li').slice(0, 15).toArray();
|
|
46
41
|
|
|
47
42
|
const result = await util.ProcessFeed(base, list, ctx.cache); // 感谢@hoilc指导
|
|
48
43
|
|
package/lib/v2/bjfu/jwc/utils.js
CHANGED
|
@@ -1,61 +1,58 @@
|
|
|
1
1
|
const got = require('@/utils/got');
|
|
2
2
|
const cheerio = require('cheerio');
|
|
3
|
-
const iconv = require('iconv-lite'); // 转码
|
|
4
3
|
const { parseDate } = require('@/utils/parse-date');
|
|
5
4
|
const timezone = require('@/utils/timezone');
|
|
6
5
|
|
|
7
6
|
// 完整文章页
|
|
8
7
|
async function load(link) {
|
|
9
|
-
const response = await got.get(link
|
|
10
|
-
responseType: 'buffer',
|
|
11
|
-
});
|
|
8
|
+
const response = await got.get(link);
|
|
12
9
|
|
|
13
|
-
const data =
|
|
10
|
+
const data = response.data; // 不用转码
|
|
14
11
|
|
|
15
12
|
// 加载文章内容
|
|
16
13
|
const $ = cheerio.load(data);
|
|
17
14
|
|
|
18
|
-
// 解析日期
|
|
19
|
-
const pubDate = timezone(
|
|
20
|
-
parseDate(
|
|
21
|
-
$('div #con_djl')
|
|
22
|
-
.text()
|
|
23
|
-
.match(/\d{4}-\d{2}-\d{2}/)
|
|
24
|
-
),
|
|
25
|
-
+8
|
|
26
|
-
);
|
|
27
|
-
|
|
28
15
|
// 提取内容
|
|
29
|
-
const description = $('#con_c').html();
|
|
16
|
+
const description = ($('#con_c').length ? $('#con_c').html() : '') + ($('#con_fujian').length ? $('#con_fujian').html() : '');
|
|
30
17
|
|
|
31
18
|
// 返回解析的结果
|
|
32
|
-
return { description
|
|
19
|
+
return { description };
|
|
33
20
|
}
|
|
34
21
|
|
|
35
22
|
const ProcessFeed = (base, list, caches) =>
|
|
36
23
|
Promise.all(
|
|
37
24
|
// 遍历每一篇文章
|
|
38
|
-
list.map(
|
|
25
|
+
list.map((item) => {
|
|
39
26
|
const $ = cheerio.load(item);
|
|
40
27
|
|
|
41
28
|
const $title = $('a');
|
|
42
29
|
// 还原相对链接为绝对链接
|
|
43
30
|
const itemUrl = new URL($title.attr('href'), base).href; // 感谢@hoilc指导
|
|
44
31
|
|
|
45
|
-
//
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
32
|
+
// 解析日期
|
|
33
|
+
const pubDate = timezone(
|
|
34
|
+
parseDate(
|
|
35
|
+
$('.datetime')
|
|
36
|
+
.text()
|
|
37
|
+
.match(/\d{4}-\d{2}-\d{2}/)
|
|
38
|
+
),
|
|
39
|
+
+8
|
|
40
|
+
);
|
|
52
41
|
|
|
53
42
|
// 使用tryGet方法从缓存获取内容。
|
|
54
43
|
// 当缓存中无法获取到链接内容的时候,则使用load方法加载文章内容。
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
44
|
+
return caches.tryGet(itemUrl, async () => {
|
|
45
|
+
const { description } = await load(itemUrl);
|
|
46
|
+
|
|
47
|
+
// 列表上提取到的信息
|
|
48
|
+
return {
|
|
49
|
+
title: $title.text(),
|
|
50
|
+
link: itemUrl,
|
|
51
|
+
author: '北林教务处',
|
|
52
|
+
description,
|
|
53
|
+
pubDate,
|
|
54
|
+
};
|
|
55
|
+
});
|
|
59
56
|
})
|
|
60
57
|
);
|
|
61
58
|
module.exports = {
|
package/lib/v2/bjfu/kjc.js
CHANGED
|
@@ -1,60 +1,47 @@
|
|
|
1
1
|
const got = require('@/utils/got');
|
|
2
2
|
const cheerio = require('cheerio');
|
|
3
|
-
const
|
|
3
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
4
|
+
const timezone = require('@/utils/timezone');
|
|
4
5
|
|
|
5
6
|
module.exports = async (ctx) => {
|
|
6
7
|
const url = 'http://kyc.bjfu.edu.cn/tztg/index.html';
|
|
7
|
-
const response = await got.get(url
|
|
8
|
-
|
|
9
|
-
});
|
|
10
|
-
const data = iconv.decode(response.data, 'gb2312');
|
|
8
|
+
const response = await got.get(url);
|
|
9
|
+
const data = response.data;
|
|
11
10
|
const $ = cheerio.load(data);
|
|
12
11
|
const list = $('.ll_con_r_b li')
|
|
13
|
-
.slice(0,
|
|
14
|
-
.
|
|
12
|
+
.slice(0, 15)
|
|
13
|
+
.toArray()
|
|
14
|
+
.map((e) => {
|
|
15
15
|
const element = $(e);
|
|
16
16
|
const title = element.find('.ll_con_r_b_title a').text();
|
|
17
17
|
const link = element.find('a').attr('href');
|
|
18
|
-
const date =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
);
|
|
24
|
-
const timeZone = 8;
|
|
25
|
-
const serverOffset = date.getTimezoneOffset() / 60;
|
|
26
|
-
const pubDate = new Date(date.getTime() - 60 * 60 * 1000 * (timeZone + serverOffset)).toUTCString();
|
|
18
|
+
const date = element
|
|
19
|
+
.find('.ll_con_r_b_time')
|
|
20
|
+
.text()
|
|
21
|
+
.match(/\d{4}-\d{2}-\d{2}/);
|
|
22
|
+
const pubDate = timezone(parseDate(date), 8);
|
|
27
23
|
|
|
28
24
|
return {
|
|
29
25
|
title,
|
|
30
|
-
description: '',
|
|
31
26
|
link: 'http://kyc.bjfu.edu.cn/tztg/' + link,
|
|
32
27
|
author: '北京林业大学科技处通知公告',
|
|
33
28
|
pubDate,
|
|
34
29
|
};
|
|
35
|
-
})
|
|
36
|
-
.get();
|
|
30
|
+
});
|
|
37
31
|
|
|
38
32
|
const result = await Promise.all(
|
|
39
|
-
list.map(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
const itemElement = cheerio.load(data);
|
|
52
|
-
|
|
53
|
-
item.description = itemElement('#a_con_l_con').html();
|
|
54
|
-
|
|
55
|
-
ctx.cache.set(link, JSON.stringify(item));
|
|
56
|
-
return item;
|
|
57
|
-
})
|
|
33
|
+
list.map((item) =>
|
|
34
|
+
ctx.cache.tryGet(item.link, async () => {
|
|
35
|
+
const itemReponse = await got.get(item.link);
|
|
36
|
+
const data = itemReponse.data;
|
|
37
|
+
const itemElement = cheerio.load(data);
|
|
38
|
+
|
|
39
|
+
item.description = itemElement('#a_con_l_con').html();
|
|
40
|
+
item.title = item.title.includes('...') ? itemElement('#a_con_l_title').text() : item.title;
|
|
41
|
+
|
|
42
|
+
return item;
|
|
43
|
+
})
|
|
44
|
+
)
|
|
58
45
|
);
|
|
59
46
|
|
|
60
47
|
ctx.state.data = {
|