rsshub 1.0.0-master.fc5a2f6 → 1.0.0-master.fc648b5
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 +4 -0
- package/lib/middleware/anti-hotlink.js +90 -22
- package/lib/middleware/parameter.js +65 -32
- package/lib/middleware/templates/iframe.art +14 -0
- package/lib/radar-rules.js +0 -92
- package/lib/router.js +22 -22
- package/lib/routes/agefans/update.js +1 -1
- package/lib/routes/novel/biqugeinfo.js +2 -2
- package/lib/routes/universities/uestc/sice.js +12 -33
- package/lib/routes/weibo/user.js +10 -19
- package/lib/v2/19lou/index.js +74 -0
- package/lib/v2/19lou/maintainer.js +3 -0
- package/lib/v2/19lou/radar.js +29 -0
- package/lib/v2/19lou/router.js +3 -0
- package/lib/v2/36kr/router.js +1 -1
- package/lib/v2/36kr/user.js +47 -22
- package/lib/v2/acfun/article.js +100 -0
- package/lib/{routes → v2}/acfun/bangumi.js +7 -7
- package/lib/v2/acfun/maintainer.js +5 -0
- package/lib/v2/acfun/radar.js +25 -0
- package/lib/v2/acfun/router.js +5 -0
- package/lib/v2/acfun/video.js +45 -0
- package/lib/v2/agora0/index.js +54 -0
- package/lib/v2/agora0/maintainer.js +3 -0
- package/lib/v2/agora0/radar.js +13 -0
- package/lib/v2/agora0/router.js +3 -0
- package/lib/v2/apnews/maintainer.js +3 -0
- package/lib/v2/apnews/radar.js +13 -0
- package/lib/v2/apnews/router.js +3 -0
- package/lib/v2/apnews/templates/description.art +14 -0
- package/lib/v2/apnews/topics.js +44 -0
- package/lib/v2/appleinsider/index.js +59 -0
- package/lib/v2/appleinsider/maintainer.js +3 -0
- package/lib/v2/appleinsider/radar.js +13 -0
- package/lib/v2/appleinsider/router.js +3 -0
- package/lib/v2/cbnweek/index.js +46 -0
- package/lib/v2/cbnweek/maintainer.js +3 -0
- package/lib/v2/cbnweek/radar.js +13 -0
- package/lib/v2/cbnweek/router.js +3 -0
- package/lib/v2/ccac/news.js +12 -3
- package/lib/v2/cde/index.js +2 -2
- package/lib/v2/cde/maintainer.js +1 -0
- package/lib/v2/cde/radar.js +22 -4
- package/lib/v2/cde/router.js +1 -0
- package/lib/v2/cde/templates/xxgk/breakthroughCure.art +18 -0
- package/lib/v2/cde/templates/xxgk/cliniCal.art +16 -0
- package/lib/v2/cde/templates/xxgk/priorityApproval.art +18 -0
- package/lib/v2/cde/utils.js +2 -2
- package/lib/v2/cde/xxgk.js +73 -0
- package/lib/v2/chinadegrees/maintainer.js +3 -0
- package/lib/v2/chinadegrees/province.js +66 -0
- package/lib/v2/chinadegrees/radar.js +13 -0
- package/lib/v2/chinadegrees/router.js +3 -0
- package/lib/v2/chinadegrees/templates/description.art +4 -0
- package/lib/v2/cnjxol/index.js +94 -0
- package/lib/v2/cnjxol/maintainer.js +4 -0
- package/lib/v2/cnjxol/radar.js +19 -0
- package/lib/v2/cnjxol/router.js +3 -0
- package/lib/v2/cnjxol/templates/description.art +2 -0
- package/lib/v2/cscse/maintainer.js +3 -0
- package/lib/v2/cscse/radar.js +13 -0
- package/lib/v2/cscse/router.js +3 -0
- package/lib/v2/cscse/tzgg.js +54 -0
- package/lib/v2/dgjyw/index.js +67 -0
- package/lib/v2/dgjyw/maintainer.js +3 -0
- package/lib/v2/dgjyw/radar.js +13 -0
- package/lib/v2/dgjyw/router.js +3 -0
- package/lib/v2/domp4/detail.js +67 -0
- package/lib/v2/domp4/latest.js +31 -0
- package/lib/v2/domp4/maintainer.js +4 -0
- package/lib/v2/domp4/radar.js +25 -0
- package/lib/v2/domp4/router.js +4 -0
- package/lib/v2/domp4/utils.js +72 -0
- package/lib/v2/douyin/hashtag.js +5 -43
- package/lib/v2/douyin/live.js +68 -0
- package/lib/v2/douyin/maintainer.js +2 -0
- package/lib/v2/douyin/radar.js +8 -0
- package/lib/v2/douyin/router.js +1 -0
- package/lib/v2/douyin/user.js +5 -43
- package/lib/v2/douyin/utils.js +50 -0
- package/lib/v2/economist/full.js +6 -4
- package/lib/v2/elsevier/issue.js +62 -0
- package/lib/v2/elsevier/journal.js +72 -0
- package/lib/v2/elsevier/maintainer.js +2 -2
- package/lib/v2/elsevier/radar.js +5 -5
- package/lib/v2/elsevier/router.js +4 -2
- package/lib/v2/elsevier/templates/description.art +5 -5
- package/lib/v2/gov/beijing/jw/tzgg.js +58 -0
- package/lib/v2/gov/customs/list.js +21 -17
- package/lib/v2/gov/customs/utils.js +9 -5
- package/lib/v2/gov/maintainer.js +3 -0
- package/lib/v2/gov/nmpa/generic.js +76 -0
- package/lib/v2/gov/pbc/goutongjiaoliu.js +20 -15
- package/lib/v2/gov/pbc/tradeAnnouncement.js +18 -14
- package/lib/v2/gov/radar.js +57 -27
- package/lib/v2/gov/router.js +3 -0
- package/lib/v2/gov/xuzhou/hrss.js +54 -0
- package/lib/v2/hackertalk/index.js +23 -0
- package/lib/v2/hackertalk/maintainer.js +3 -0
- package/lib/v2/hackertalk/radar.js +13 -0
- package/lib/v2/hackertalk/router.js +3 -0
- package/lib/v2/hashnode/blog.js +62 -0
- package/lib/v2/hashnode/maintainer.js +3 -0
- package/lib/v2/hashnode/radar.js +13 -0
- package/lib/v2/hashnode/router.js +3 -0
- package/lib/v2/hashnode/templates/description.art +2 -0
- package/lib/v2/hdu/cs/{index.js → notice.js} +1 -4
- package/lib/v2/hdu/cs/pg.js +54 -0
- package/lib/v2/hdu/maintainer.js +1 -0
- package/lib/v2/hdu/radar.js +6 -0
- package/lib/v2/hdu/router.js +2 -1
- package/lib/v2/heu/gx/list.js +2 -2
- package/lib/v2/heu/job/list.js +2 -2
- package/lib/v2/heu/uae/list.js +2 -2
- package/lib/v2/heu/yjsy/list.js +2 -2
- package/lib/v2/hk01/channel.js +40 -0
- package/lib/{routes → v2}/hk01/hot.js +2 -1
- package/lib/v2/hk01/issue.js +41 -0
- package/lib/v2/hk01/maintainer.js +7 -0
- package/lib/v2/hk01/radar.js +37 -0
- package/lib/v2/hk01/router.js +7 -0
- package/lib/{routes → v2}/hk01/tag.js +2 -1
- package/lib/{routes → v2}/hk01/zone.js +3 -2
- package/lib/v2/hotukdeals/index.js +1 -1
- package/lib/v2/ieee/journal.js +78 -0
- package/lib/v2/ieee/maintainer.js +2 -2
- package/lib/v2/ieee/radar.js +4 -4
- package/lib/v2/ieee/{latestdate.js → recent.js} +34 -42
- package/lib/v2/ieee/router.js +4 -2
- package/lib/v2/ieee/templates/description.art +5 -5
- package/lib/v2/ielts/index.js +7 -2
- package/lib/v2/keep/maintainer.js +3 -0
- package/lib/v2/keep/radar.js +13 -0
- package/lib/v2/keep/router.js +3 -0
- package/lib/v2/keep/templates/user.art +16 -0
- package/lib/{routes → v2}/keep/user.js +14 -4
- package/lib/v2/mdpi/journal.js +65 -0
- package/lib/v2/mdpi/maintainer.js +3 -0
- package/lib/v2/mdpi/radar.js +13 -0
- package/lib/v2/mdpi/router.js +3 -0
- package/lib/v2/mdpi/templates/description.art +12 -0
- package/lib/v2/mindmeister/example.js +44 -0
- package/lib/v2/mindmeister/maintainer.js +3 -0
- package/lib/v2/mindmeister/radar.js +13 -0
- package/lib/v2/mindmeister/router.js +3 -0
- package/lib/v2/mindmeister/templates/image.art +1 -0
- package/lib/v2/mirror/index.js +34 -0
- package/lib/v2/mirror/maintainer.js +3 -0
- package/lib/v2/mirror/radar.js +17 -0
- package/lib/v2/mirror/router.js +3 -0
- package/lib/v2/nbd/radar.js +2 -2
- package/lib/v2/ncwu/maintainer.js +3 -0
- package/lib/v2/ncwu/notice.js +27 -0
- package/lib/v2/ncwu/radar.js +13 -0
- package/lib/v2/ncwu/router.js +3 -0
- package/lib/v2/netease/exclusive.js +148 -0
- package/lib/v2/netease/maintainer.js +1 -0
- package/lib/v2/netease/radar.js +8 -0
- package/lib/v2/netease/router.js +1 -0
- package/lib/v2/netease/templates/exclusive.art +11 -0
- package/lib/v2/nju/rczp.js +34 -24
- package/lib/v2/njust/utils.js +4 -0
- package/lib/v2/nuaa/utils/pypasswaf.js +4 -5
- package/lib/v2/nyaa/maintainer.js +4 -0
- package/lib/v2/nyaa/radar.js +32 -0
- package/lib/v2/nyaa/router.js +4 -0
- package/lib/{routes → v2}/nyaa/search.js +4 -2
- package/lib/v2/nytimes/daily_briefing_chinese.js +47 -41
- package/lib/v2/nytimes/index.js +3 -3
- package/lib/v2/nytimes/maintainer.js +1 -1
- package/lib/v2/nytimes/templates/image.art +3 -0
- package/lib/v2/nytimes/utils.js +7 -1
- package/lib/v2/oceanengine/arithmeticIndex.js +145 -0
- package/lib/v2/oceanengine/maintainer.js +3 -0
- package/lib/v2/oceanengine/radar.js +13 -0
- package/lib/v2/oceanengine/router.js +3 -0
- package/lib/v2/oceanengine/templates/content.art +14 -0
- package/lib/v2/openwrt/maintainer.js +3 -0
- package/lib/v2/openwrt/radar.js +13 -0
- package/lib/v2/openwrt/releases.js +25 -0
- package/lib/v2/openwrt/router.js +3 -0
- package/lib/v2/pincong/utils.js +7 -1
- package/lib/v2/pku/maintainer.js +3 -0
- package/lib/v2/pku/radar.js +20 -0
- package/lib/v2/pku/router.js +3 -0
- package/lib/v2/pku/ss/admission.js +53 -0
- package/lib/v2/pku/ss/notice.js +53 -0
- package/lib/v2/pku/ss/pg_admin.js +53 -0
- package/lib/v2/prestige-av/maintainer.js +3 -0
- package/lib/v2/prestige-av/radar.js +18 -0
- package/lib/v2/prestige-av/router.js +3 -0
- package/lib/{routes → v2}/prestige-av/series.js +8 -5
- package/lib/v2/qq/kg/cache.js +28 -0
- package/lib/v2/qq/kg/reply.js +21 -0
- package/lib/v2/qq/kg/user.js +50 -0
- package/lib/v2/qq/maintainer.js +2 -0
- package/lib/v2/qq/radar.js +14 -0
- package/lib/v2/qq/router.js +2 -0
- package/lib/v2/samsung/maintainer.js +3 -0
- package/lib/v2/samsung/radar.js +13 -0
- package/lib/v2/samsung/research/blog.js +49 -0
- package/lib/v2/samsung/router.js +3 -0
- package/lib/v2/{jasa/latest.js → scitation/journal.js} +24 -27
- package/lib/v2/scitation/maintainer.js +4 -0
- package/lib/v2/scitation/radar.js +19 -0
- package/lib/v2/scitation/router.js +4 -0
- package/lib/v2/scitation/section.js +90 -0
- package/lib/v2/scitation/templates/description.art +11 -0
- package/lib/v2/shuiguopai/index.js +76 -0
- package/lib/v2/shuiguopai/maintainer.js +3 -0
- package/lib/v2/shuiguopai/radar.js +13 -0
- package/lib/v2/shuiguopai/router.js +3 -0
- package/lib/v2/shuiguopai/templates/description.art +6 -0
- package/lib/v2/springer/journal.js +72 -0
- package/lib/v2/springer/maintainer.js +3 -0
- package/lib/v2/springer/radar.js +13 -0
- package/lib/v2/springer/router.js +3 -0
- package/lib/v2/springer/templates/description.art +12 -0
- package/lib/v2/supchina/index.js +67 -0
- package/lib/v2/supchina/maintainer.js +4 -0
- package/lib/v2/supchina/podcasts.js +66 -0
- package/lib/v2/supchina/radar.js +19 -0
- package/lib/v2/supchina/router.js +4 -0
- package/lib/v2/techflow520/index.js +34 -0
- package/lib/v2/techflow520/maintainer.js +4 -0
- package/lib/v2/techflow520/newsflash.js +32 -0
- package/lib/v2/techflow520/radar.js +19 -0
- package/lib/v2/techflow520/router.js +4 -0
- package/lib/v2/tencent/cloud/column.js +51 -0
- package/lib/v2/tencent/maintainer.js +1 -0
- package/lib/v2/tencent/radar.js +11 -0
- package/lib/v2/tencent/router.js +1 -0
- package/lib/v2/test/index.js +16 -1
- package/lib/v2/tiktok/user.js +28 -38
- package/lib/v2/trending/allTrending.js +169 -0
- package/lib/v2/trending/maintainer.js +3 -0
- package/lib/v2/trending/radar.js +35 -0
- package/lib/v2/trending/router.js +3 -0
- package/lib/v2/trending/templates/content.art +24 -0
- package/lib/v2/u3c3/index.js +59 -0
- package/lib/v2/u3c3/maintainer.js +3 -0
- package/lib/v2/u3c3/radar.js +29 -0
- package/lib/v2/u3c3/router.js +3 -0
- package/lib/v2/uraaka-joshi/uraaka-joshi-user.js +7 -1
- package/lib/v2/uraaka-joshi/uraaka-joshi.js +8 -1
- package/lib/v2/vlive/index.js +71 -0
- package/lib/v2/vlive/maintainer.js +3 -0
- package/lib/v2/vlive/radar.js +13 -0
- package/lib/v2/vlive/router.js +3 -0
- package/lib/v2/vlive/templates/post.art +8 -0
- package/lib/v2/vlive/templates/video.art +3 -0
- package/lib/v2/xiaohongshu/util.js +6 -6
- package/lib/v2/xjtu/2yuan/news.js +61 -0
- package/lib/v2/xjtu/dean.js +83 -0
- package/lib/{routes/universities → v2}/xjtu/ee.js +5 -5
- package/lib/{routes/universities → v2}/xjtu/gs/tzgg.js +6 -6
- package/lib/v2/xjtu/international.js +51 -0
- package/lib/v2/xjtu/job.js +81 -0
- package/lib/v2/xjtu/maintainer.js +9 -0
- package/lib/v2/xjtu/radar.js +53 -0
- package/lib/v2/xjtu/router.js +9 -0
- package/lib/v2/xjtu/std.js +58 -0
- package/lib/v2/xjtu/templates/attachments.art +3 -0
- package/lib/v2/xjtu/templates/std.art +4 -0
- package/lib/v2/xueqiu/column.js +42 -0
- package/lib/v2/xueqiu/maintainer.js +1 -0
- package/lib/v2/xueqiu/radar.js +6 -0
- package/lib/v2/xueqiu/router.js +1 -0
- package/lib/v2/zhangyoubao/index.js +42 -0
- package/lib/v2/zhangyoubao/maintainer.js +3 -0
- package/lib/v2/zhangyoubao/radar.js +13 -0
- package/lib/v2/zhangyoubao/router.js +3 -0
- package/lib/v2/zhangyoubao/templates/article.art +1 -0
- package/package.json +20 -19
- package/lib/routes/acfun/video.js +0 -44
- package/lib/routes/apnews/topics.js +0 -43
- package/lib/routes/dgjyw/index.js +0 -66
- package/lib/routes/hk01/channel.js +0 -22
- package/lib/routes/hk01/issue.js +0 -22
- package/lib/routes/mirror/entries.js +0 -80
- package/lib/routes/universities/ncwu/notice.js +0 -42
- package/lib/routes/universities/xjtu/dean.js +0 -86
- package/lib/routes/universities/xjtu/international.js +0 -53
- package/lib/routes/universities/xjtu/job.js +0 -50
- package/lib/v2/elsevier/latest.js +0 -87
- package/lib/v2/elsevier/volume.js +0 -75
- package/lib/v2/ieee/latestvol.js +0 -87
- package/lib/v2/jasa/maintainer.js +0 -4
- package/lib/v2/jasa/radar.js +0 -19
- package/lib/v2/jasa/router.js +0 -4
- package/lib/v2/jasa/section.js +0 -95
- package/lib/v2/jasa/templates/description.art +0 -11
|
@@ -1,61 +1,67 @@
|
|
|
1
1
|
const got = require('@/utils/got');
|
|
2
2
|
const cheerio = require('cheerio');
|
|
3
3
|
const { parseDate } = require('@/utils/parse-date');
|
|
4
|
+
const { art } = require('@/utils/render');
|
|
5
|
+
const path = require('path');
|
|
4
6
|
|
|
5
7
|
module.exports = async (ctx) => {
|
|
6
|
-
const
|
|
8
|
+
const rootUrl = 'https://www.nytimes.com';
|
|
9
|
+
const currentUrl = `${rootUrl}/zh-hans/series/daily-briefing-chinese`;
|
|
10
|
+
|
|
7
11
|
const response = await got({
|
|
8
12
|
method: 'get',
|
|
9
|
-
url,
|
|
13
|
+
url: currentUrl,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const listData = JSON.parse(response.data.match(/"initialState":(.*),"config"/)[1]);
|
|
17
|
+
|
|
18
|
+
let items = [];
|
|
19
|
+
Object.keys(listData).forEach((key) => {
|
|
20
|
+
if (/^Article:/.test(key) && listData[key].url) {
|
|
21
|
+
const item = listData[key];
|
|
22
|
+
items.push({
|
|
23
|
+
link: item.url,
|
|
24
|
+
pubDate: parseDate(item.firstPublished),
|
|
25
|
+
});
|
|
26
|
+
}
|
|
10
27
|
});
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
.map((index, elem) => {
|
|
15
|
-
const $item = $(elem);
|
|
16
|
-
const $link = $item.find('a');
|
|
17
|
-
const $title = $item.find('h2');
|
|
18
|
-
|
|
19
|
-
return {
|
|
20
|
-
title: $title.text(),
|
|
21
|
-
link: 'https://www.nytimes.com' + $link.attr('href'),
|
|
22
|
-
};
|
|
23
|
-
})
|
|
24
|
-
.get();
|
|
25
|
-
|
|
26
|
-
const items = await Promise.all(
|
|
27
|
-
post.map((item) =>
|
|
28
|
+
|
|
29
|
+
items = await Promise.all(
|
|
30
|
+
items.map((item) =>
|
|
28
31
|
ctx.cache.tryGet(item.link, async () => {
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const imageLink = arr.map((e) => JSON.parse(`{${e}}`).url);
|
|
33
|
-
|
|
34
|
-
const $ = cheerio.load(data);
|
|
35
|
-
$('.css-pncxxs.etfikam0').remove();
|
|
36
|
-
// remove 'Credit...'
|
|
37
|
-
$('.css-1ly73wi.e1tej78p0').remove();
|
|
38
|
-
$('.css-1xdhyk6.erfvjey0').each((i, e) => $(e).replaceWith(`<img src="${imageLink[i]}">`));
|
|
39
|
-
|
|
40
|
-
$('.css-1l44abu.ewdxa0s0').each((i, e) => {
|
|
41
|
-
const figureNote = $(e)
|
|
42
|
-
.children()
|
|
43
|
-
.map((i, e) => $(e).text())
|
|
44
|
-
.get();
|
|
45
|
-
$(e).replaceWith(`<p><small>${figureNote.join(' ')}</small><p>`);
|
|
32
|
+
const detailResponse = await got({
|
|
33
|
+
method: 'get',
|
|
34
|
+
url: item.link,
|
|
46
35
|
});
|
|
47
|
-
const date = $('time').attr('datetime');
|
|
48
36
|
|
|
49
|
-
|
|
50
|
-
|
|
37
|
+
const content = cheerio.load(detailResponse.data);
|
|
38
|
+
|
|
39
|
+
// to remove ads
|
|
40
|
+
content('.StoryBodyCompanionColumn').last().find('p').last().remove();
|
|
41
|
+
|
|
42
|
+
const images = detailResponse.data.match(/"url":"[^{}]+","name":"articleLarge"/g).map((e) => JSON.parse(`{${e}}`).url);
|
|
43
|
+
|
|
44
|
+
let i = 0;
|
|
45
|
+
content('figure').each(function () {
|
|
46
|
+
content(this).html(
|
|
47
|
+
art(path.join(__dirname, 'templates/image.art'), {
|
|
48
|
+
url: images[i++],
|
|
49
|
+
})
|
|
50
|
+
);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
item.title = content('meta[property="og:title"]').attr('content');
|
|
54
|
+
item.author = content('meta[name="byl"]').attr('content').replace(/By /, '');
|
|
55
|
+
item.description = content('section[name="articleBody"]').html();
|
|
56
|
+
|
|
51
57
|
return item;
|
|
52
58
|
})
|
|
53
59
|
)
|
|
54
60
|
);
|
|
55
61
|
|
|
56
62
|
ctx.state.data = {
|
|
57
|
-
title: '
|
|
58
|
-
link:
|
|
63
|
+
title: '新闻简报 - The New York Times',
|
|
64
|
+
link: currentUrl,
|
|
59
65
|
item: items,
|
|
60
66
|
};
|
|
61
67
|
};
|
package/lib/v2/nytimes/index.js
CHANGED
|
@@ -38,7 +38,7 @@ module.exports = async (ctx) => {
|
|
|
38
38
|
|
|
39
39
|
try {
|
|
40
40
|
response = await ctx.cache.tryGet(`nyt: ${link}`, async () => {
|
|
41
|
-
const response = await got
|
|
41
|
+
const response = await got(link);
|
|
42
42
|
|
|
43
43
|
return response.data;
|
|
44
44
|
});
|
|
@@ -46,14 +46,14 @@ module.exports = async (ctx) => {
|
|
|
46
46
|
dual = true;
|
|
47
47
|
} catch (error) {
|
|
48
48
|
response = await ctx.cache.tryGet(`nyt: ${item.link}`, async () => {
|
|
49
|
-
const response = await got
|
|
49
|
+
const response = await got(item.link);
|
|
50
50
|
|
|
51
51
|
return response.data;
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
} else {
|
|
55
55
|
response = await ctx.cache.tryGet(`nyt: ${item.link}`, async () => {
|
|
56
|
-
const response = await got
|
|
56
|
+
const response = await got(item.link);
|
|
57
57
|
|
|
58
58
|
return response.data;
|
|
59
59
|
});
|
package/lib/v2/nytimes/utils.js
CHANGED
|
@@ -16,7 +16,13 @@ const ProcessImage = ($, e) => {
|
|
|
16
16
|
const PuppeterGetter = async (ctx, browser, link) => {
|
|
17
17
|
const result = await ctx.cache.tryGet(`nyt: ${link}`, async () => {
|
|
18
18
|
const page = await browser.newPage();
|
|
19
|
-
await page.
|
|
19
|
+
await page.setRequestInterception(true);
|
|
20
|
+
page.on('request', (request) => {
|
|
21
|
+
request.resourceType() === 'document' ? request.continue() : request.abort();
|
|
22
|
+
});
|
|
23
|
+
await page.goto(link, {
|
|
24
|
+
waitUntil: 'domcontentloaded',
|
|
25
|
+
});
|
|
20
26
|
const response = await page.evaluate(() => document.querySelector('body').innerHTML);
|
|
21
27
|
return response;
|
|
22
28
|
});
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
const dayjs = require('dayjs');
|
|
2
|
+
const { art } = require('@/utils/render');
|
|
3
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
4
|
+
const timezone = require('@/utils/timezone');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
const config = require('@/config').value;
|
|
7
|
+
|
|
8
|
+
// Parameters
|
|
9
|
+
const CACHE_MAX_AGE = config.cache.contentExpire;
|
|
10
|
+
const DEFAULT_FETCH_DURATION_MONTH = 6; // fetch data 6 month from now
|
|
11
|
+
|
|
12
|
+
// Fetch Data
|
|
13
|
+
const getMultiKeywordHotTrend = async (page, keyword, start_date, end_date, app_name = 'aweme') => {
|
|
14
|
+
const e = {
|
|
15
|
+
url: 'https://trendinsight.oceanengine.com/api/open/index/get_multi_keyword_hot_trend',
|
|
16
|
+
method: 'POST',
|
|
17
|
+
data: JSON.stringify({ keyword_list: [keyword], start_date, end_date, app_name }),
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const res = await page.evaluate((e) => {
|
|
21
|
+
function queryData() {
|
|
22
|
+
const p = new Promise((resolve) => {
|
|
23
|
+
const req = new XMLHttpRequest();
|
|
24
|
+
req.open(e.method, e.url, true);
|
|
25
|
+
req.setRequestHeader('accept', 'application/json, text/plain, */*');
|
|
26
|
+
req.setRequestHeader('content-type', 'application/json;charset=UTF-8');
|
|
27
|
+
req.setRequestHeader('tea-uid', '7054893410171930123');
|
|
28
|
+
req.onreadystatechange = function () {
|
|
29
|
+
if (req.readyState === 4 && req.status === 200) {
|
|
30
|
+
resolve(req.responseText);
|
|
31
|
+
} else {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
req.send(e.data);
|
|
36
|
+
});
|
|
37
|
+
return p;
|
|
38
|
+
}
|
|
39
|
+
return Promise.all([queryData()]).then((result) => result);
|
|
40
|
+
}, e);
|
|
41
|
+
return res[0];
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// Decrypt Data
|
|
45
|
+
const { createDecipheriv } = require('node:crypto');
|
|
46
|
+
const key = 'anN2bXA2NjYsamlh';
|
|
47
|
+
const iv = 'amlheW91LHFpYW53';
|
|
48
|
+
const algorithm = 'aes-128-cfb';
|
|
49
|
+
const decrypt = (rawData) => {
|
|
50
|
+
const encrypted = Buffer.from(rawData, 'base64').toString('hex');
|
|
51
|
+
const decipher = createDecipheriv(algorithm, key, iv);
|
|
52
|
+
const decrypted = decipher.update(encrypted, 'hex', 'utf8') + decipher.final('utf8');
|
|
53
|
+
return JSON.parse(decrypted);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
// Generate Feed
|
|
57
|
+
const searchLinkUrls = (keyword) => [
|
|
58
|
+
`https://tophub.today/search?e=tophub&q=${keyword}`,
|
|
59
|
+
`https://www.baidu.com/s?wd=${keyword}`,
|
|
60
|
+
`https://www.google.com/search?q=${keyword}`,
|
|
61
|
+
`https://m.zhihu.com/search?type=content&q=${keyword}`,
|
|
62
|
+
`https://s.weibo.com/weibo/${keyword}`,
|
|
63
|
+
`https://www.douyin.com/search/${keyword}`,
|
|
64
|
+
`https://so.toutiao.com/search?keyword=${keyword}`,
|
|
65
|
+
];
|
|
66
|
+
|
|
67
|
+
const searchLinkNames = ['今日热榜', '百度', '谷歌', '知乎', '微博', '抖音', '头条'];
|
|
68
|
+
|
|
69
|
+
const createContent = (keyword, queryList, queryListText) =>
|
|
70
|
+
art(path.join(__dirname, 'templates', 'content.art'), {
|
|
71
|
+
keyword,
|
|
72
|
+
queryListText,
|
|
73
|
+
queries: queryList.map((query) => ({
|
|
74
|
+
links: searchLinkUrls(encodeURIComponent(query)).map((url, index) => `<a href="${url}" rel="noopener noreferrer" target="_blank">${searchLinkNames[index]}</a>`),
|
|
75
|
+
key: query,
|
|
76
|
+
})),
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
module.exports = async (ctx) => {
|
|
80
|
+
const now = dayjs();
|
|
81
|
+
const start_date = now.subtract(DEFAULT_FETCH_DURATION_MONTH, 'month').format('YYYYMMDD');
|
|
82
|
+
const end_date = now.format('YYYYMMDD');
|
|
83
|
+
const keyword = ctx.params.keyword;
|
|
84
|
+
if (!keyword) {
|
|
85
|
+
throw Error('Invalid keyword');
|
|
86
|
+
}
|
|
87
|
+
if (ctx.params.channel && !['douyin', 'toutiao'].includes(ctx.params.channel)) {
|
|
88
|
+
throw Error('Invalid channel。 Only support `douyin` or `toutiao`');
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const channel = ctx.params.channel === 'toutiao' ? 'toutiao' : 'aweme'; // default channel is `douyin`
|
|
92
|
+
const channelName = ctx.params.channel === 'toutiao' ? '头条' : '抖音';
|
|
93
|
+
|
|
94
|
+
const link = `https://trendinsight.oceanengine.com/arithmetic-index/analysis?keyword=${keyword}&appName=${channel}`;
|
|
95
|
+
|
|
96
|
+
const item = await ctx.cache.tryGet(
|
|
97
|
+
link,
|
|
98
|
+
async () => {
|
|
99
|
+
const browser = await require('@/utils/puppeteer')();
|
|
100
|
+
const page = await browser.newPage();
|
|
101
|
+
await page.setRequestInterception(true);
|
|
102
|
+
page.on('request', (request) => {
|
|
103
|
+
request.resourceType() === 'document' || request.resourceType() === 'script' || request.resourceType() === 'xhr' ? request.continue() : request.abort();
|
|
104
|
+
});
|
|
105
|
+
await page.goto('https://trendinsight.oceanengine.com/arithmetic-index');
|
|
106
|
+
const res = await getMultiKeywordHotTrend(page, keyword, start_date, end_date, channel);
|
|
107
|
+
browser.close();
|
|
108
|
+
|
|
109
|
+
const rawData = JSON.parse(res).data;
|
|
110
|
+
const data = decrypt(rawData).hot_list[0];
|
|
111
|
+
|
|
112
|
+
const searchAverage = parseInt(data.average.search_average);
|
|
113
|
+
|
|
114
|
+
return data.search_top_point_list.map(({ date, query_list }) => {
|
|
115
|
+
const searchIndex = parseInt(data.search_hot_list.find((listItem) => listItem.datetime === date).index);
|
|
116
|
+
const relativePercent = Math.round(((searchIndex - searchAverage) / searchAverage) * 100);
|
|
117
|
+
const icon = relativePercent > 0 ? '📈' : '📉';
|
|
118
|
+
|
|
119
|
+
const uniqueQueryList = query_list.filter((query) => query !== keyword);
|
|
120
|
+
const uniqueQueryListStr = uniqueQueryList.join(', ');
|
|
121
|
+
|
|
122
|
+
const content = createContent(keyword, [keyword, ...uniqueQueryList], uniqueQueryListStr);
|
|
123
|
+
|
|
124
|
+
return {
|
|
125
|
+
title: `${icon} ${keyword} ${relativePercent}% | ${uniqueQueryListStr}`,
|
|
126
|
+
author: `巨量算数 - ${channelName}算数指数`,
|
|
127
|
+
description: content,
|
|
128
|
+
link,
|
|
129
|
+
pubDate: timezone(parseDate(date), +8),
|
|
130
|
+
guid: `巨量算数 - ${channelName}算数指数 | ${keyword} - ${date}`,
|
|
131
|
+
};
|
|
132
|
+
});
|
|
133
|
+
},
|
|
134
|
+
CACHE_MAX_AGE,
|
|
135
|
+
false
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
ctx.state.data = {
|
|
139
|
+
title: `${keyword} - ${channelName}指数波峰`,
|
|
140
|
+
link,
|
|
141
|
+
description: `巨量算数 - ${channelName}算数指数 | 关键词: ${keyword}`,
|
|
142
|
+
language: 'zh-cn',
|
|
143
|
+
item,
|
|
144
|
+
};
|
|
145
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
'oceanengine.com': {
|
|
3
|
+
_name: '巨量算数',
|
|
4
|
+
trendinsight: [
|
|
5
|
+
{
|
|
6
|
+
title: '抖音/头条指数波峰',
|
|
7
|
+
docs: 'https://docs.rsshub.app/other.html#ju-liang-suan-shu-suan-shu-zhi-shu',
|
|
8
|
+
source: ['/arithmetic-index/analysis'],
|
|
9
|
+
target: (params, url) => `/oceanengine/index/${new URL(url).searchParams.get('keyword')}`,
|
|
10
|
+
},
|
|
11
|
+
],
|
|
12
|
+
},
|
|
13
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
const cheerio = require('cheerio');
|
|
3
|
+
|
|
4
|
+
module.exports = async (ctx) => {
|
|
5
|
+
const brand = ctx.params.brand;
|
|
6
|
+
const model = ctx.params.model;
|
|
7
|
+
const url = `https://openwrt.org/toh/${brand}/${model}`;
|
|
8
|
+
const response = await got(url);
|
|
9
|
+
const $ = cheerio.load(response.data);
|
|
10
|
+
const table = $('#installation').next();
|
|
11
|
+
|
|
12
|
+
ctx.state.data = {
|
|
13
|
+
title: $('h1').text() + ' - OpenWrt Releases',
|
|
14
|
+
link: url,
|
|
15
|
+
description: $('.dw-content div.level1').text(),
|
|
16
|
+
language: 'en-US',
|
|
17
|
+
item: [
|
|
18
|
+
{
|
|
19
|
+
title: table.find('.supported_current_rel').text(),
|
|
20
|
+
link: url,
|
|
21
|
+
description: `Firmware OpenWrt Install: ${table.find('.firmware_openwrt_install_url').html()}<br><br>Firmware OpenWrt Upgrade: ${$('.firmware_openwrt_upgrade_url').html()}'`,
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
};
|
|
25
|
+
};
|
package/lib/v2/pincong/utils.js
CHANGED
|
@@ -4,7 +4,13 @@ const puppeteerGet = (url, cache) =>
|
|
|
4
4
|
cache.tryGet(url, async () => {
|
|
5
5
|
const browser = await require('@/utils/puppeteer')();
|
|
6
6
|
const page = await browser.newPage();
|
|
7
|
-
await page.
|
|
7
|
+
await page.setRequestInterception(true);
|
|
8
|
+
page.on('request', (request) => {
|
|
9
|
+
request.resourceType() === 'document' ? request.continue() : request.abort();
|
|
10
|
+
});
|
|
11
|
+
await page.goto(url, {
|
|
12
|
+
waitUntil: 'domcontentloaded',
|
|
13
|
+
});
|
|
8
14
|
const html = await page.evaluate(() => document.documentElement.innerHTML);
|
|
9
15
|
browser.close();
|
|
10
16
|
return html;
|
package/lib/v2/pku/maintainer.js
CHANGED
package/lib/v2/pku/radar.js
CHANGED
|
@@ -126,5 +126,25 @@ module.exports = {
|
|
|
126
126
|
},
|
|
127
127
|
},
|
|
128
128
|
],
|
|
129
|
+
ss: [
|
|
130
|
+
{
|
|
131
|
+
title: '软微-通知公告',
|
|
132
|
+
docs: 'https://docs.rsshub.app/university.html#bei-jing-da-xue',
|
|
133
|
+
source: ['/index.php/newscenter/notice', '/'],
|
|
134
|
+
target: '/pku/ss/notice',
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
title: '软微-招生通知',
|
|
138
|
+
docs: 'https://docs.rsshub.app/university.html#bei-jing-da-xue',
|
|
139
|
+
source: ['/admission/admnotice', '/'],
|
|
140
|
+
target: '/pku/ss/admission',
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
title: '软微-硕士统考招生',
|
|
144
|
+
docs: 'https://docs.rsshub.app/university.html#bei-jing-da-xue',
|
|
145
|
+
source: ['/admission/admbrochure/admission01', '/'],
|
|
146
|
+
target: '/pku/ss/pgadmin',
|
|
147
|
+
},
|
|
148
|
+
],
|
|
129
149
|
},
|
|
130
150
|
};
|
package/lib/v2/pku/router.js
CHANGED
|
@@ -7,4 +7,7 @@ module.exports = function (router) {
|
|
|
7
7
|
router.get('/nsd/gd', require('./nsd'));
|
|
8
8
|
router.get('/rccp/mzyt', require('./rccp/mzyt'));
|
|
9
9
|
router.get('/scc/recruit/:type?', require('./scc/recruit'));
|
|
10
|
+
router.get('/ss/notice', require('./ss/notice.js'));
|
|
11
|
+
router.get('/ss/admission', require('./ss/admission.js'));
|
|
12
|
+
router.get('/ss/pgadmin', require('./ss/pg_admin.js'));
|
|
10
13
|
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
const cheerio = require('cheerio');
|
|
3
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
4
|
+
|
|
5
|
+
const link = 'http://www.ss.pku.edu.cn';
|
|
6
|
+
const host = 'http://www.ss.pku.edu.cn/index.php/admission/admnotice';
|
|
7
|
+
|
|
8
|
+
const getSingleRecord = async () => {
|
|
9
|
+
const res = await got(host);
|
|
10
|
+
|
|
11
|
+
const $ = cheerio.load(res.data);
|
|
12
|
+
const list = $('#info-list-ul').find('li');
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
list &&
|
|
16
|
+
list
|
|
17
|
+
.map((index, item) => {
|
|
18
|
+
item = $(item);
|
|
19
|
+
const date = item.find('.time').text();
|
|
20
|
+
return {
|
|
21
|
+
title: item.find('a').attr('title'),
|
|
22
|
+
pubDate: parseDate(date),
|
|
23
|
+
link: link + item.find('a').attr('href'),
|
|
24
|
+
};
|
|
25
|
+
})
|
|
26
|
+
.get()
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
module.exports = async (ctx) => {
|
|
31
|
+
const items = await getSingleRecord();
|
|
32
|
+
const out = await Promise.all(
|
|
33
|
+
items.map((item) =>
|
|
34
|
+
ctx.cache.tryGet(item.link, async () => {
|
|
35
|
+
const response = await got(item.link);
|
|
36
|
+
const $ = cheerio.load(response.data);
|
|
37
|
+
return {
|
|
38
|
+
title: item.title,
|
|
39
|
+
link: item.link,
|
|
40
|
+
description: $('.article-content').html(),
|
|
41
|
+
pubDate: item.pubDate,
|
|
42
|
+
};
|
|
43
|
+
})
|
|
44
|
+
)
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
ctx.state.data = {
|
|
48
|
+
title: '北大软微-招生通知',
|
|
49
|
+
description: '北京大学软件与微电子学院 - 招生通知',
|
|
50
|
+
link: host,
|
|
51
|
+
item: out,
|
|
52
|
+
};
|
|
53
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
const cheerio = require('cheerio');
|
|
3
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
4
|
+
|
|
5
|
+
const link = 'http://www.ss.pku.edu.cn';
|
|
6
|
+
const host = 'http://www.ss.pku.edu.cn/index.php/newscenter/notice';
|
|
7
|
+
|
|
8
|
+
const getSingleRecord = async () => {
|
|
9
|
+
const res = await got(host);
|
|
10
|
+
|
|
11
|
+
const $ = cheerio.load(res.data);
|
|
12
|
+
const list = $('#info-list-ul').find('li');
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
list &&
|
|
16
|
+
list
|
|
17
|
+
.map((index, item) => {
|
|
18
|
+
item = $(item);
|
|
19
|
+
const date = item.find('.time').text();
|
|
20
|
+
return {
|
|
21
|
+
title: item.find('a').attr('title'),
|
|
22
|
+
pubDate: parseDate(date),
|
|
23
|
+
link: link + item.find('a').attr('href'),
|
|
24
|
+
};
|
|
25
|
+
})
|
|
26
|
+
.get()
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
module.exports = async (ctx) => {
|
|
31
|
+
const items = await getSingleRecord();
|
|
32
|
+
const out = await Promise.all(
|
|
33
|
+
items.map((item) =>
|
|
34
|
+
ctx.cache.tryGet(item.link, async () => {
|
|
35
|
+
const response = await got(item.link);
|
|
36
|
+
const $ = cheerio.load(response.data);
|
|
37
|
+
return {
|
|
38
|
+
title: item.title,
|
|
39
|
+
link: item.link,
|
|
40
|
+
description: $('.article-content').html(),
|
|
41
|
+
pubDate: item.pubDate,
|
|
42
|
+
};
|
|
43
|
+
})
|
|
44
|
+
)
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
ctx.state.data = {
|
|
48
|
+
title: '北大软微-通知公告',
|
|
49
|
+
description: '北京大学软件与微电子学院 - 通知公告',
|
|
50
|
+
link: host,
|
|
51
|
+
item: out,
|
|
52
|
+
};
|
|
53
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
const cheerio = require('cheerio');
|
|
3
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
4
|
+
|
|
5
|
+
const link = 'http://www.ss.pku.edu.cn';
|
|
6
|
+
const host = 'http://www.ss.pku.edu.cn/index.php/admission/admbrochure/admission01';
|
|
7
|
+
|
|
8
|
+
const getSingleRecord = async () => {
|
|
9
|
+
const res = await got(host);
|
|
10
|
+
|
|
11
|
+
const $ = cheerio.load(res.data);
|
|
12
|
+
const list = $('#info-list-ul').find('li');
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
list &&
|
|
16
|
+
list
|
|
17
|
+
.map((index, item) => {
|
|
18
|
+
item = $(item);
|
|
19
|
+
const date = item.find('.time').text();
|
|
20
|
+
return {
|
|
21
|
+
title: item.find('a').attr('title'),
|
|
22
|
+
pubDate: parseDate(date),
|
|
23
|
+
link: link + item.find('a').attr('href'),
|
|
24
|
+
};
|
|
25
|
+
})
|
|
26
|
+
.get()
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
module.exports = async (ctx) => {
|
|
31
|
+
const items = await getSingleRecord();
|
|
32
|
+
const out = await Promise.all(
|
|
33
|
+
items.map((item) =>
|
|
34
|
+
ctx.cache.tryGet(item.link, async () => {
|
|
35
|
+
const response = await got(item.link);
|
|
36
|
+
const $ = cheerio.load(response.data);
|
|
37
|
+
return {
|
|
38
|
+
title: item.title,
|
|
39
|
+
link: item.link,
|
|
40
|
+
description: $('.article-content').html(),
|
|
41
|
+
pubDate: item.pubDate,
|
|
42
|
+
};
|
|
43
|
+
})
|
|
44
|
+
)
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
ctx.state.data = {
|
|
48
|
+
title: '北大软微-硕士统考招生',
|
|
49
|
+
description: '北京大学软件与微电子学院 - 硕士统考招生通知',
|
|
50
|
+
link: host,
|
|
51
|
+
item: out,
|
|
52
|
+
};
|
|
53
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
'prestige-av.com': {
|
|
3
|
+
_name: 'Prestige 蚊香社',
|
|
4
|
+
'.': [
|
|
5
|
+
{
|
|
6
|
+
title: '系列作品',
|
|
7
|
+
docs: 'https://docs.rsshub.app/multimedia.html#prestige-wen-xiang-she',
|
|
8
|
+
source: ['/goods/goods_list.php'],
|
|
9
|
+
target: (_params, url) => {
|
|
10
|
+
const link = new URL(url);
|
|
11
|
+
if (link.searchParams.get('mode') === 'series') {
|
|
12
|
+
return link.searchParams.has('sort') ? `/prestige-av/series/${link.searchParams.get('mid')}/${link.searchParams.get('sort')}` : `/prestige-av/series/${link.searchParams.get('mid')}`;
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
},
|
|
18
|
+
};
|