rsshub 1.0.0-master.f97cdb2 → 1.0.0-master.fa3428f
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 +1 -1
- package/lib/config.js +3 -1
- package/lib/radar-rules.js +0 -92
- package/lib/router.js +68 -71
- package/lib/routes/tencent/wechat/miniprogram/framework.js +4 -2
- package/lib/utils/common-config.js +4 -0
- package/lib/utils/parse-date.js +8 -7
- package/lib/utils/rand-user-agent.js +29 -0
- package/lib/utils/request-wrapper.js +2 -5
- package/lib/utils/wechat-mp.js +106 -10
- package/lib/v2/agirls/index.js +6 -0
- package/lib/v2/bilibili/video.js +1 -0
- package/lib/v2/bookfere/category.js +36 -0
- package/lib/v2/bookfere/maintainer.js +3 -0
- package/lib/v2/bookfere/radar.js +11 -0
- package/lib/v2/bookfere/router.js +3 -0
- package/lib/v2/cankaoxiaoxi/index.js +81 -0
- package/lib/v2/cankaoxiaoxi/maintainer.js +3 -0
- package/lib/v2/cankaoxiaoxi/radar.js +61 -0
- package/lib/v2/cankaoxiaoxi/router.js +3 -0
- package/lib/{routes → v2}/cctv/category.js +1 -1
- package/lib/{routes → v2}/cctv/jx.js +6 -1
- package/lib/{routes → v2}/cctv/lm.js +1 -1
- package/lib/v2/cctv/maintainer.js +7 -0
- package/lib/v2/cctv/radar.js +41 -0
- package/lib/v2/cctv/router.js +7 -0
- package/lib/{routes → v2}/cctv/special.js +6 -4
- package/lib/{routes → v2}/cctv/utils/mzzlbg.js +8 -6
- package/lib/{routes → v2}/cctv/utils/news.js +25 -22
- package/lib/{routes → v2}/cctv/utils/xinwen1j1.js +20 -17
- package/lib/v2/cctv/xwlb.js +50 -0
- package/lib/v2/chinacef/experts.js +38 -0
- package/lib/v2/chinacef/hot.js +38 -0
- package/lib/v2/chinacef/index.js +39 -0
- package/lib/v2/chinacef/maintainer.js +5 -0
- package/lib/v2/chinacef/radar.js +25 -0
- package/lib/v2/chinacef/router.js +5 -0
- package/lib/v2/{wechat → chinacef}/templates/description.art +0 -0
- package/lib/v2/chinacef/utils.js +55 -0
- package/lib/v2/chinanews/index.js +65 -0
- package/lib/v2/chinanews/maintainer.js +3 -0
- package/lib/v2/chinanews/radar.js +13 -0
- package/lib/v2/chinanews/router.js +3 -0
- package/lib/v2/cnbeta/index.js +2 -1
- package/lib/v2/cnbeta/utils.js +1 -0
- package/lib/v2/dapenti/maintainer.js +4 -0
- package/lib/v2/dapenti/radar.js +27 -0
- package/lib/v2/dapenti/router.js +4 -0
- package/lib/{routes → v2}/dapenti/subject.js +1 -1
- package/lib/{routes → v2}/dapenti/tugua.js +1 -1
- package/lib/v2/dapenti/utils.js +75 -0
- package/lib/{routes → v2}/dongqiudi/daily.js +10 -13
- package/lib/v2/dongqiudi/maintainer.js +8 -0
- package/lib/{routes → v2}/dongqiudi/player_news.js +0 -0
- package/lib/v2/dongqiudi/radar.js +45 -0
- package/lib/{routes → v2}/dongqiudi/result.js +2 -1
- package/lib/v2/dongqiudi/router.js +8 -0
- package/lib/{routes → v2}/dongqiudi/special.js +0 -0
- package/lib/{routes → v2}/dongqiudi/team_news.js +0 -0
- package/lib/{routes → v2}/dongqiudi/top_news.js +12 -15
- package/lib/{routes → v2}/dongqiudi/utils.js +47 -28
- package/lib/v2/dut/defaults.js +53 -0
- package/lib/v2/dut/index.js +78 -0
- package/lib/v2/dut/maintainer.js +14 -0
- package/lib/v2/dut/radar.js +109 -0
- package/lib/v2/dut/router.js +4 -0
- package/lib/v2/dut/shortcuts.js +77 -0
- package/lib/{routes → v2}/dx2025/index.js +0 -0
- package/lib/v2/dx2025/maintainer.js +3 -0
- package/lib/v2/dx2025/radar.js +19 -0
- package/lib/v2/dx2025/router.js +3 -0
- package/lib/v2/e-hentai/radar.js +21 -3
- package/lib/v2/eagle/blog.js +47 -0
- package/lib/{routes → v2}/eagle/changelog.js +3 -1
- package/lib/v2/eagle/maintainer.js +4 -0
- package/lib/v2/eagle/radar.js +101 -0
- package/lib/v2/eagle/router.js +4 -0
- package/lib/{routes → v2}/ehentai/ehapi.js +50 -21
- package/lib/{routes → v2}/ehentai/favorites.js +4 -2
- package/lib/v2/ehentai/maintainer.js +5 -0
- package/lib/v2/ehentai/router.js +5 -0
- package/lib/{routes → v2}/ehentai/search.js +5 -3
- package/lib/{routes → v2}/ehentai/tag.js +4 -2
- package/lib/v2/firefox/index.js +7 -2
- package/lib/v2/fortunechina/index.js +1 -1
- package/lib/v2/github/comments.js +7 -0
- package/lib/v2/gitpod/blog.js +8 -0
- package/lib/v2/gov/maintainer.js +1 -0
- package/lib/v2/gov/nrta/news.js +63 -0
- package/lib/v2/gov/radar.js +11 -0
- package/lib/v2/gov/router.js +1 -0
- package/lib/v2/guancha/index.js +1 -1
- package/lib/v2/guangdiu/cheaps.js +28 -0
- package/lib/v2/guangdiu/index.js +44 -0
- package/lib/v2/guangdiu/maintainer.js +5 -0
- package/lib/v2/guangdiu/radar.js +25 -0
- package/lib/v2/guangdiu/rank.js +38 -0
- package/lib/v2/guangdiu/router.js +5 -0
- package/lib/{routes/guokr/calendar.js → v2/guokr/channel.js} +2 -2
- package/lib/v2/guokr/maintainer.js +4 -0
- package/lib/v2/guokr/radar.js +19 -0
- package/lib/v2/guokr/router.js +4 -0
- package/lib/{routes → v2}/guokr/scientific.js +3 -3
- package/lib/v2/hkej/index.js +9 -15
- package/lib/v2/hkepc/index.js +8 -0
- package/lib/v2/hket/index.js +10 -2
- package/lib/v2/huangz/index.js +29 -0
- package/lib/v2/huangz/maintainer.js +3 -0
- package/lib/v2/huangz/radar.js +13 -0
- package/lib/v2/huangz/router.js +3 -0
- package/lib/v2/huanqiu/index.js +65 -0
- package/lib/v2/huanqiu/maintainer.js +3 -0
- package/lib/v2/huanqiu/radar.js +13 -0
- package/lib/v2/huanqiu/router.js +3 -0
- package/lib/v2/miris/blog.js +19 -0
- package/lib/v2/miris/maintainer.js +3 -0
- package/lib/v2/miris/radar.js +11 -0
- package/lib/v2/miris/router.js +3 -0
- package/lib/v2/news/whxw.js +2 -2
- package/lib/v2/npm/package.js +1 -1
- package/lib/v2/npm/router.js +1 -1
- package/lib/v2/qbittorrent/maintainer.js +3 -0
- package/lib/v2/qbittorrent/news.js +59 -0
- package/lib/v2/qbittorrent/radar.js +13 -0
- package/lib/v2/qbittorrent/router.js +3 -0
- package/lib/v2/rsshub/sponsors.js +1 -0
- package/lib/{routes → v2}/sciencenet/blog.js +17 -12
- package/lib/v2/sciencenet/maintainer.js +4 -0
- package/lib/v2/sciencenet/radar.js +19 -0
- package/lib/v2/sciencenet/router.js +4 -0
- package/lib/v2/sciencenet/user.js +65 -0
- package/lib/v2/sdu/cmse.js +59 -0
- package/lib/v2/sdu/cs.js +57 -0
- package/lib/v2/sdu/data.js +110 -0
- package/lib/v2/sdu/epe.js +55 -0
- package/lib/v2/sdu/extractor/index.js +15 -0
- package/lib/v2/sdu/extractor/sdrj.js +21 -0
- package/lib/v2/sdu/extractor/view.js +21 -0
- package/lib/v2/sdu/extractor/wh/jwc.js +24 -0
- package/lib/v2/sdu/extractor/wh/news.js +21 -0
- package/lib/v2/sdu/maintainer.js +9 -0
- package/lib/v2/sdu/mech.js +60 -0
- package/lib/v2/sdu/radar.js +159 -0
- package/lib/v2/sdu/router.js +9 -0
- package/lib/v2/sdu/sc.js +61 -0
- package/lib/v2/sdu/wh/jwc.js +42 -0
- package/lib/v2/sdu/wh/news.js +38 -0
- package/lib/v2/stratechery/index.js +20 -0
- package/lib/v2/stratechery/maintainer.js +3 -0
- package/lib/v2/stratechery/radar.js +11 -0
- package/lib/v2/stratechery/router.js +3 -0
- package/lib/{routes → v2}/taptap/changelog.js +2 -1
- package/lib/v2/taptap/maintainer.js +5 -0
- package/lib/v2/taptap/radar.js +25 -0
- package/lib/v2/taptap/review.js +69 -0
- package/lib/v2/taptap/router.js +5 -0
- package/lib/v2/taptap/templates/videoPost.art +2 -0
- package/lib/v2/taptap/topic.js +79 -0
- package/lib/v2/taptap/utils.js +48 -0
- package/lib/v2/thecover/channel.js +66 -0
- package/lib/v2/thecover/maintainer.js +3 -0
- package/lib/v2/thecover/radar.js +13 -0
- package/lib/v2/thecover/router.js +3 -0
- package/lib/{routes → v2}/twreporter/category.js +7 -12
- package/lib/{routes → v2}/twreporter/fetch_article.js +5 -4
- package/lib/v2/twreporter/maintainer.js +5 -0
- package/lib/{routes → v2}/twreporter/newest.js +8 -13
- package/lib/v2/twreporter/photography.js +46 -0
- package/lib/v2/twreporter/radar.js +25 -0
- package/lib/v2/twreporter/router.js +5 -0
- package/lib/{routes/tencent → v2}/wechat/announce.js +3 -2
- package/lib/v2/wechat/ce.js +69 -0
- package/lib/v2/wechat/data258.js +137 -0
- package/lib/v2/wechat/ershcimi.js +35 -0
- package/lib/{routes/tencent → v2}/wechat/feeds.js +0 -0
- package/lib/v2/wechat/maintainer.js +11 -0
- package/lib/{routes/tencent → v2}/wechat/mp.js +0 -0
- package/lib/{routes/tencent → v2}/wechat/msgalbum.js +0 -0
- package/lib/v2/wechat/radar.js +76 -1
- package/lib/v2/wechat/router.js +11 -0
- package/lib/{routes/tencent → v2}/wechat/tgchannel.js +0 -0
- package/lib/{routes/tencent → v2}/wechat/uread.js +0 -0
- package/lib/{routes/tencent → v2}/wechat/wemp.js +0 -0
- package/lib/{routes/tencent → v2}/wechat/wxnmh.js +0 -0
- package/lib/{routes → v2}/xueqiu/favorite.js +2 -1
- package/lib/v2/xueqiu/fund.js +50 -0
- package/lib/{routes → v2}/xueqiu/hots.js +2 -1
- package/lib/v2/xueqiu/maintainer.js +10 -0
- package/lib/v2/xueqiu/radar.js +60 -0
- package/lib/v2/xueqiu/router.js +10 -0
- package/lib/{routes → v2}/xueqiu/snb.js +2 -1
- package/lib/{routes → v2}/xueqiu/stock_comments.js +4 -20
- package/lib/{routes → v2}/xueqiu/stock_info.js +2 -1
- package/lib/v2/xueqiu/templates/comments_description.art +10 -0
- package/lib/{routes → v2}/xueqiu/user.js +2 -1
- package/lib/{routes → v2}/xueqiu/user_stock.js +3 -2
- package/lib/v2/yunspe/maintainer.js +3 -0
- package/lib/v2/yunspe/newsflash.js +42 -0
- package/lib/v2/yunspe/radar.js +13 -0
- package/lib/v2/yunspe/router.js +3 -0
- package/lib/{routes → v2}/yystv/category.js +8 -8
- package/lib/{routes → v2}/yystv/docs.js +2 -2
- package/lib/v2/yystv/maintainer.js +4 -0
- package/lib/v2/yystv/radar.js +49 -0
- package/lib/v2/yystv/router.js +4 -0
- package/lib/{routes/universities → v2}/zju/career/index.js +14 -13
- package/lib/{routes/universities → v2}/zju/cst/custom.js +2 -1
- package/lib/{routes/universities → v2}/zju/cst/index.js +20 -24
- package/lib/v2/zju/grs/index.js +43 -0
- package/lib/v2/zju/list.js +66 -0
- package/lib/v2/zju/maintainer.js +8 -0
- package/lib/v2/zju/physics/index.js +52 -0
- package/lib/v2/zju/radar.js +139 -0
- package/lib/v2/zju/router.js +8 -0
- package/lib/views/atom.art +13 -1
- package/lib/views/welcome.art +4 -1
- package/package.json +13 -12
- package/lib/routes/cctv/xwlb.js +0 -48
- package/lib/routes/dapenti/utils.js +0 -73
- package/lib/routes/taptap/review.js +0 -39
- package/lib/routes/taptap/topic.js +0 -85
- package/lib/routes/tencent/wechat/_README +0 -1
- package/lib/routes/tencent/wechat/ce.js +0 -40
- package/lib/routes/tencent/wechat/ershcimi.js +0 -43
- package/lib/routes/twreporter/photography.js +0 -57
- package/lib/routes/universities/dut/index.js +0 -60
- package/lib/routes/universities/dut/subsite.js +0 -50
- package/lib/routes/universities/sdu/cmse.js +0 -55
- package/lib/routes/universities/sdu/cs.js +0 -55
- package/lib/routes/universities/sdu/epe.js +0 -54
- package/lib/routes/universities/sdu/mech.js +0 -58
- package/lib/routes/universities/sdu/sc.js +0 -56
- package/lib/routes/universities/zju/grs/index.js +0 -44
- package/lib/routes/universities/zju/list.js +0 -78
- package/lib/routes/universities/zju/physics/index.js +0 -55
- package/lib/routes/xueqiu/fund.js +0 -71
- package/lib/v2/wechat/templates/image.art +0 -1
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
const got = require('@/utils/got');
|
|
2
|
-
const cheerio = require('cheerio');
|
|
3
|
-
|
|
4
|
-
const host = 'http://grs.zju.edu.cn/redir.php?catalog_id=16313';
|
|
5
|
-
|
|
6
|
-
const map = new Map([
|
|
7
|
-
[1, { title: '浙大研究生院 -- 全部公告', tag: '' }],
|
|
8
|
-
[2, { title: '浙大研究生院 -- 教学管理', tag: '&tag=%E6%95%99%E5%AD%A6%E7%AE%A1%E7%90%86' }],
|
|
9
|
-
[3, { title: '浙大研究生院 -- 各类资助', tag: '&tag=%E5%90%84%E7%B1%BB%E8%B5%84%E5%8A%A9' }],
|
|
10
|
-
[4, { title: '浙大研究生院 -- 学科建设', tag: '&tag=%E5%AD%A6%E7%A7%91%E5%BB%BA%E8%AE%BE' }],
|
|
11
|
-
[5, { title: '浙大研究生院 -- 海外交流', tag: '&tag=%E6%B5%B7%E5%A4%96%E4%BA%A4%E6%B5%81' }],
|
|
12
|
-
]);
|
|
13
|
-
|
|
14
|
-
module.exports = async (ctx) => {
|
|
15
|
-
const type = Number.parseInt(ctx.params.type);
|
|
16
|
-
const tag = map.get(type).tag;
|
|
17
|
-
const res = await got({
|
|
18
|
-
method: 'get',
|
|
19
|
-
url: `${host}${tag}`,
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
const $ = cheerio.load(res.data);
|
|
23
|
-
const list = $('.cg-pic-news-list').find('li').slice(0, 20);
|
|
24
|
-
|
|
25
|
-
const items =
|
|
26
|
-
list &&
|
|
27
|
-
list
|
|
28
|
-
.map((index, item) => {
|
|
29
|
-
item = $(item);
|
|
30
|
-
return {
|
|
31
|
-
title: item.find('a').text(),
|
|
32
|
-
pubDate: new Date(item.find('.art-dateee').text()).toUTCString(),
|
|
33
|
-
link: `http://grs.zju.edu.cn/${item.find('a').eq(-1).attr('href')}`,
|
|
34
|
-
description: item.find('div').text(),
|
|
35
|
-
};
|
|
36
|
-
})
|
|
37
|
-
.get();
|
|
38
|
-
|
|
39
|
-
ctx.state.data = {
|
|
40
|
-
title: map.get(type).title,
|
|
41
|
-
link: `${host}${tag}`,
|
|
42
|
-
item: items,
|
|
43
|
-
};
|
|
44
|
-
};
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
const got = require('@/utils/got');
|
|
2
|
-
const cheerio = require('cheerio');
|
|
3
|
-
const url = require('url');
|
|
4
|
-
const host = 'http://www.zju.edu.cn/';
|
|
5
|
-
module.exports = async (ctx) => {
|
|
6
|
-
const type = ctx.params.type || 'xs';
|
|
7
|
-
const link = host + type + `/list.htm`;
|
|
8
|
-
const response = await got({
|
|
9
|
-
method: 'get',
|
|
10
|
-
url: link,
|
|
11
|
-
headers: {
|
|
12
|
-
Referer: host,
|
|
13
|
-
},
|
|
14
|
-
});
|
|
15
|
-
const $ = cheerio.load(response.data);
|
|
16
|
-
|
|
17
|
-
function sortDate(e) {
|
|
18
|
-
// console.log(e);
|
|
19
|
-
const pubday = e.substr(-3, 2);
|
|
20
|
-
const pubmonth = e.substr(-6, 2);
|
|
21
|
-
const pubyear = e.substr(-11, 4);
|
|
22
|
-
const pubdateString = pubmonth + `-` + pubday + `-` + pubyear;
|
|
23
|
-
// console.log(pubdateString);
|
|
24
|
-
|
|
25
|
-
return pubdateString;
|
|
26
|
-
}
|
|
27
|
-
function sortUrl(e) {
|
|
28
|
-
if (e.search('redirect') !== -1) {
|
|
29
|
-
return link;
|
|
30
|
-
} else {
|
|
31
|
-
return e;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
const list = $('#wp_news_w7 ul.news li')
|
|
35
|
-
.map(function () {
|
|
36
|
-
const info = {
|
|
37
|
-
title: $(this).find('a').text(),
|
|
38
|
-
link: sortUrl($(this).find('a').attr('href')),
|
|
39
|
-
date: sortDate($(this).text()),
|
|
40
|
-
};
|
|
41
|
-
return info;
|
|
42
|
-
})
|
|
43
|
-
.get();
|
|
44
|
-
const out = await Promise.all(
|
|
45
|
-
list.map(async (info) => {
|
|
46
|
-
const title = info.title;
|
|
47
|
-
const date = info.date;
|
|
48
|
-
const itemUrl = url.resolve(host, info.link);
|
|
49
|
-
const cache = await ctx.cache.get(itemUrl);
|
|
50
|
-
if (cache) {
|
|
51
|
-
return Promise.resolve(JSON.parse(cache));
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const response = await got({
|
|
55
|
-
method: 'get',
|
|
56
|
-
url: itemUrl,
|
|
57
|
-
headers: {
|
|
58
|
-
Referer: link,
|
|
59
|
-
},
|
|
60
|
-
});
|
|
61
|
-
const $ = cheerio.load(response.data);
|
|
62
|
-
const description = $('.right_content').html();
|
|
63
|
-
const single = {
|
|
64
|
-
title,
|
|
65
|
-
link: itemUrl,
|
|
66
|
-
description,
|
|
67
|
-
pubDate: new Date(date).toLocaleDateString(),
|
|
68
|
-
};
|
|
69
|
-
ctx.cache.set(itemUrl, JSON.stringify(single));
|
|
70
|
-
return Promise.resolve(single);
|
|
71
|
-
})
|
|
72
|
-
);
|
|
73
|
-
ctx.state.data = {
|
|
74
|
-
title: `浙江大学` + $('ul.submenu .selected').text(),
|
|
75
|
-
link,
|
|
76
|
-
item: out,
|
|
77
|
-
};
|
|
78
|
-
};
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
const got = require('@/utils/got');
|
|
2
|
-
const cheerio = require('cheerio');
|
|
3
|
-
const iconv = require('iconv-lite');
|
|
4
|
-
|
|
5
|
-
const host = 'http://physics.zju.edu.cn/redir.php?catalog_id=';
|
|
6
|
-
// const host = 'http://10.14.122.238/redir.php?catalog_id=';
|
|
7
|
-
|
|
8
|
-
const map = new Map([
|
|
9
|
-
[1, { title: '浙大物理系 -- 本系动态', id: '66' }],
|
|
10
|
-
[2, { title: '浙大物理系 -- 科研通知', id: '88' }],
|
|
11
|
-
[3, { title: '浙大物理系 -- 研究生教育最新消息', id: '104' }],
|
|
12
|
-
[4, { title: '浙大物理系 -- 学生思政最新消息', id: '112' }],
|
|
13
|
-
[5, { title: '浙大物理系 -- 研究生思政消息公告', id: '155' }],
|
|
14
|
-
[6, { title: '浙大物理系 -- 研究生奖助学金', id: '661' }],
|
|
15
|
-
[7, { title: '浙大物理系 -- 研究生思政就业信息', id: '664' }],
|
|
16
|
-
[8, { title: '浙大物理系 -- 本科生思政消息公告', id: '667' }],
|
|
17
|
-
[9, { title: '浙大物理系 -- 本科生奖助学金', id: '670' }],
|
|
18
|
-
[10, { title: '浙大物理系 -- 本科生就业信息', id: '671' }],
|
|
19
|
-
[11, { title: '浙大物理系 -- 学术报告', id: '3735' }],
|
|
20
|
-
]);
|
|
21
|
-
|
|
22
|
-
module.exports = async (ctx) => {
|
|
23
|
-
const type = Number.parseInt(ctx.params.type);
|
|
24
|
-
const id = map.get(type).id;
|
|
25
|
-
const res = await got({
|
|
26
|
-
method: 'get',
|
|
27
|
-
url: `${host}${id}`,
|
|
28
|
-
responseType: 'buffer',
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
const $ = cheerio.load(iconv.decode(res.data, 'gb2312'));
|
|
32
|
-
const list = $('.art_list').find('li').slice(0, 20);
|
|
33
|
-
|
|
34
|
-
const items =
|
|
35
|
-
list &&
|
|
36
|
-
list
|
|
37
|
-
.map((index, item) => {
|
|
38
|
-
item = $(item);
|
|
39
|
-
return {
|
|
40
|
-
title: item.find('a').text(),
|
|
41
|
-
// title: item.find('a').attr('title'),
|
|
42
|
-
pubDate: new Date(item.find('.date').text()).toUTCString(),
|
|
43
|
-
|
|
44
|
-
link: `http://physics.zju.edu.cn/${item.find('a').attr('href')}`,
|
|
45
|
-
// link: `http://10.14.122.238/${item.find('a').attr('href')}`,
|
|
46
|
-
};
|
|
47
|
-
})
|
|
48
|
-
.get();
|
|
49
|
-
|
|
50
|
-
ctx.state.data = {
|
|
51
|
-
title: map.get(type).title,
|
|
52
|
-
link: `${host}${id}`,
|
|
53
|
-
item: items,
|
|
54
|
-
};
|
|
55
|
-
};
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
const got = require('@/utils/got');
|
|
2
|
-
const cheerio = require('cheerio');
|
|
3
|
-
|
|
4
|
-
module.exports = async (ctx) => {
|
|
5
|
-
const guid = `xueqiu/fund ${ctx.params.id}`;
|
|
6
|
-
const cache = await ctx.cache.get(guid);
|
|
7
|
-
|
|
8
|
-
if (cache) {
|
|
9
|
-
return Promise.resolve(JSON.parse(cache));
|
|
10
|
-
} else {
|
|
11
|
-
const url = `https://xueqiu.com/S/F${ctx.params.id}`;
|
|
12
|
-
|
|
13
|
-
let fundName = await got({
|
|
14
|
-
method: 'get',
|
|
15
|
-
url,
|
|
16
|
-
headers: {
|
|
17
|
-
Referer: 'https://xueqiu.com/',
|
|
18
|
-
},
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
const $ = cheerio.load(fundName.data);
|
|
22
|
-
fundName = $('.stock-name').text();
|
|
23
|
-
const fundNameShort = fundName.slice(0, -10);
|
|
24
|
-
|
|
25
|
-
const response = await got({
|
|
26
|
-
method: 'get',
|
|
27
|
-
url: `https://fund.xueqiu.com/dj/open/fund/growth/${ctx.params.id}?day=7`,
|
|
28
|
-
headers: {
|
|
29
|
-
Referer: url,
|
|
30
|
-
},
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
const data = response.data.data.fund_nav_growth.pop();
|
|
34
|
-
const yesterday = response.data.data.fund_nav_growth.pop();
|
|
35
|
-
|
|
36
|
-
let description = `${fundNameShort} <br> 最新净值 ${data.nav} <br> 今日`;
|
|
37
|
-
let title = `${fundNameShort} ${data.date.substring(5)} `;
|
|
38
|
-
|
|
39
|
-
const value = (parseFloat(data.nav) - parseFloat(yesterday.nav)).toFixed(4);
|
|
40
|
-
|
|
41
|
-
if (value > 0) {
|
|
42
|
-
description += '涨幅';
|
|
43
|
-
title += `📈 ${data.percentage}%`;
|
|
44
|
-
} else if (value < 0) {
|
|
45
|
-
description += '跌幅';
|
|
46
|
-
title += `📉 ${data.percentage}%`;
|
|
47
|
-
} else if (value === '0.0000') {
|
|
48
|
-
description += '无波动';
|
|
49
|
-
title += '持平';
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
description += ` ${data.percentage}%(¥${value})`;
|
|
53
|
-
|
|
54
|
-
const single = {
|
|
55
|
-
title,
|
|
56
|
-
description,
|
|
57
|
-
pubDate: new Date().toUTCString(),
|
|
58
|
-
guid: `${guid} ${data.date}`,
|
|
59
|
-
link: url,
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
ctx.state.data = {
|
|
63
|
-
title: fundName,
|
|
64
|
-
link: url,
|
|
65
|
-
description: `${fundName} 净值更新`,
|
|
66
|
-
item: [single],
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
ctx.cache.set(guid, JSON.stringify(ctx.state.data));
|
|
70
|
-
}
|
|
71
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<img src="{{ src }}">
|