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,50 +1,50 @@
|
|
|
1
1
|
const got = require('@/utils/got');
|
|
2
2
|
const path = require('path');
|
|
3
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
4
|
+
const timezone = require('@/utils/timezone');
|
|
5
|
+
const UA = require('@/utils/rand-user-agent')({ browser: 'mobile safari', os: 'ios', device: 'mobile' });
|
|
3
6
|
|
|
4
7
|
module.exports = async (category, ctx) => {
|
|
5
|
-
const url = `
|
|
8
|
+
const url = `https://news.cctv.com/2019/07/gaiban/cmsdatainterface/page/${category}_1.jsonp`;
|
|
6
9
|
|
|
7
10
|
const response = await got({
|
|
8
11
|
method: 'get',
|
|
9
12
|
url,
|
|
10
13
|
headers: {
|
|
11
14
|
Referer: `http://news.cctv.com/${category}`,
|
|
15
|
+
'User-Agent': UA,
|
|
12
16
|
},
|
|
13
17
|
});
|
|
14
18
|
|
|
15
19
|
const data = JSON.parse(response.data.slice(category.length + 1, -1));
|
|
16
20
|
const list = data.data.list;
|
|
17
21
|
const resultItem = await Promise.all(
|
|
18
|
-
list.map(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const value = await ctx.cache.get(key);
|
|
26
|
-
|
|
27
|
-
if (value) {
|
|
28
|
-
item.description = value;
|
|
29
|
-
} else {
|
|
22
|
+
list.map(({ title, url, focus_date, image }) =>
|
|
23
|
+
ctx.cache.tryGet(`cctv-news: ${url}`, async () => {
|
|
24
|
+
const item = {
|
|
25
|
+
title,
|
|
26
|
+
link: url,
|
|
27
|
+
pubDate: timezone(parseDate(focus_date), +8),
|
|
28
|
+
};
|
|
30
29
|
const id = path.parse(url).name;
|
|
31
30
|
const unknownTip = '未知类型,请点击<a href="https://github.com/DIYgod/RSSHub/issues">链接</a>提交issue';
|
|
32
31
|
let description;
|
|
33
32
|
let api;
|
|
34
33
|
let type;
|
|
34
|
+
let author;
|
|
35
35
|
|
|
36
36
|
if (id.startsWith('ART')) {
|
|
37
37
|
// 普通新闻
|
|
38
|
-
api = `
|
|
38
|
+
api = `https://api.cntv.cn/Article/getXinwenNextArticleInfo?serviceId=sjnews&id=${id}&t=json`;
|
|
39
39
|
type = 'ART';
|
|
40
40
|
} else if (id.startsWith('PHO')) {
|
|
41
41
|
// 图片
|
|
42
|
-
api = `
|
|
42
|
+
api = `https://api.cntv.cn/Article/contentinfo?id=${id}&serviceId=sjnews&t=json`;
|
|
43
43
|
type = 'PHO';
|
|
44
44
|
} else if (id.startsWith('VIDE')) {
|
|
45
45
|
// 视频
|
|
46
46
|
const vid = path.parse(image).name.split('-')[0];
|
|
47
|
-
api = `
|
|
47
|
+
api = `https://vdn.apps.cntv.cn/api/getHttpVideoInfo.do?pid=${vid}`;
|
|
48
48
|
type = 'VIDE';
|
|
49
49
|
} else {
|
|
50
50
|
// 未识别
|
|
@@ -56,13 +56,14 @@ module.exports = async (category, ctx) => {
|
|
|
56
56
|
method: 'get',
|
|
57
57
|
url: api,
|
|
58
58
|
headers: {
|
|
59
|
-
'User-Agent':
|
|
59
|
+
'User-Agent': UA,
|
|
60
60
|
},
|
|
61
61
|
});
|
|
62
62
|
|
|
63
63
|
switch (type) {
|
|
64
64
|
case 'ART':
|
|
65
65
|
description = data.article_content;
|
|
66
|
+
author = data.article_source;
|
|
66
67
|
break;
|
|
67
68
|
|
|
68
69
|
case 'PHO':
|
|
@@ -74,10 +75,12 @@ module.exports = async (category, ctx) => {
|
|
|
74
75
|
`;
|
|
75
76
|
return description;
|
|
76
77
|
}, '');
|
|
78
|
+
author = data.source;
|
|
77
79
|
break;
|
|
78
80
|
|
|
79
81
|
case 'VIDE':
|
|
80
82
|
description = `<video src="${data.hls_url}" controls="controls" poster="${image}" style="width: 100%"></video>`;
|
|
83
|
+
author = data.article_source;
|
|
81
84
|
break;
|
|
82
85
|
|
|
83
86
|
default:
|
|
@@ -86,16 +89,16 @@ module.exports = async (category, ctx) => {
|
|
|
86
89
|
}
|
|
87
90
|
|
|
88
91
|
item.description = description;
|
|
89
|
-
|
|
90
|
-
}
|
|
92
|
+
item.author = author;
|
|
91
93
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
+
return item;
|
|
95
|
+
})
|
|
96
|
+
)
|
|
94
97
|
);
|
|
95
98
|
|
|
96
99
|
return {
|
|
97
100
|
title: `央视新闻 ${category}`,
|
|
98
|
-
link: `
|
|
101
|
+
link: `https://news.cctv.com/${category}`,
|
|
99
102
|
description: `央视新闻 ${category}`,
|
|
100
103
|
item: resultItem,
|
|
101
104
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const got = require('@/utils/got');
|
|
2
2
|
const cheerio = require('cheerio');
|
|
3
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
3
4
|
//
|
|
4
5
|
// 测试http://localhost:1200/cctv/xinwen1j1
|
|
5
6
|
|
|
@@ -20,20 +21,19 @@ async function load(link) {
|
|
|
20
21
|
|
|
21
22
|
// poster="?" 以后再弄
|
|
22
23
|
// <video src="${videoDetail.hls_url}" controls="controls" poster="?" style="width: 100%"></video>
|
|
23
|
-
const description =
|
|
24
|
+
const description = `${$('meta[name=description]').attr('content')}<br><video src="${videoDetail.hls_url}" controls="controls" style="width: 100%"></video>`;
|
|
24
25
|
|
|
25
26
|
// 提取内容
|
|
26
27
|
return { description };
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
// 同步 列表
|
|
30
|
-
const ProcessFeed = (
|
|
31
|
+
const ProcessFeed = (data, ctx) =>
|
|
31
32
|
Promise.all(
|
|
32
|
-
list.map(async (
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
const itemDate = new Date(itemUrl.split('/VI')[0].split('com/')[1]).toUTCString();
|
|
33
|
+
data.list.map(async (data) => {
|
|
34
|
+
const title = data.title;
|
|
35
|
+
const itemUrl = data.url;
|
|
36
|
+
const itemDate = parseDate(data.focus_date);
|
|
37
37
|
|
|
38
38
|
// 列表上提取到的信息
|
|
39
39
|
const single = {
|
|
@@ -46,27 +46,30 @@ const ProcessFeed = (list, caches) =>
|
|
|
46
46
|
|
|
47
47
|
// 使用tryGet方法从缓存获取内容。
|
|
48
48
|
// 当缓存中无法获取到链接内容的时候,则使用load方法加载文章内容。
|
|
49
|
-
const other = await
|
|
49
|
+
const other = await ctx.cache.tryGet(itemUrl, () => load(itemUrl));
|
|
50
50
|
|
|
51
51
|
// 合并解析后的结果集作为该篇文章最终的输出结果
|
|
52
|
-
return
|
|
52
|
+
return { ...single, ...other };
|
|
53
53
|
})
|
|
54
54
|
);
|
|
55
|
-
module.exports = async (
|
|
56
|
-
const baseUrl = '
|
|
55
|
+
module.exports = async (ctx) => {
|
|
56
|
+
const baseUrl = 'https://api.cntv.cn/NewVideo/getVideoListByColumn?id=TOPC1451559066181661&n=20&sort=desc&p=1&mode=0&serviceId=tvcctv';
|
|
57
57
|
// 获取要处理的页面
|
|
58
|
-
const res = await got({
|
|
58
|
+
const res = await got({
|
|
59
|
+
method: 'get',
|
|
60
|
+
url: baseUrl,
|
|
61
|
+
headers: {
|
|
62
|
+
Referer: 'https://tv.cctv.com/lm/xinwen1j1/videoset/index.shtml#&Type=0',
|
|
63
|
+
},
|
|
64
|
+
});
|
|
59
65
|
|
|
60
|
-
const
|
|
66
|
+
const data = res.data.data;
|
|
61
67
|
|
|
62
|
-
let list = $('div.text').slice(0, 30); // 取前30个
|
|
63
68
|
// $('div.image').slice(0,3).find('img').attr('src')
|
|
64
69
|
// $('div.image').slice(0,3).find('a').attr('href').split('?')[0]
|
|
65
70
|
|
|
66
|
-
list = list.get();
|
|
67
|
-
|
|
68
71
|
// 处理所有的页面
|
|
69
|
-
const result = await ProcessFeed(
|
|
72
|
+
const result = await ProcessFeed(data, ctx);
|
|
70
73
|
|
|
71
74
|
return {
|
|
72
75
|
title: '《新闻1+1》- 中央电视台新闻频道',
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
3
|
+
const timezone = require('@/utils/timezone');
|
|
4
|
+
const cheerio = require('cheerio');
|
|
5
|
+
const dayjs = require('dayjs');
|
|
6
|
+
const customParseFormat = require('dayjs/plugin/customParseFormat');
|
|
7
|
+
dayjs.extend(customParseFormat);
|
|
8
|
+
|
|
9
|
+
module.exports = async (ctx) => {
|
|
10
|
+
const res = await got({ method: 'get', url: 'https://tv.cctv.com/lm/xwlb/' });
|
|
11
|
+
const $ = cheerio.load(res.data);
|
|
12
|
+
// 解析最新一期新闻联播的日期
|
|
13
|
+
const latestDate = dayjs($('.rilititle p').text(), 'YYYY-MM-DD');
|
|
14
|
+
const count = [];
|
|
15
|
+
for (let i = 0; i < 20; i++) {
|
|
16
|
+
count.push(i);
|
|
17
|
+
}
|
|
18
|
+
const resultItems = await Promise.all(
|
|
19
|
+
count.map(async (i) => {
|
|
20
|
+
const newsDate = latestDate.subtract(i, 'days').hour(19);
|
|
21
|
+
const url = `https://tv.cctv.com/lm/xwlb/day/${newsDate.format('YYYYMMDD')}.shtml`;
|
|
22
|
+
const item = {
|
|
23
|
+
title: `新闻联播 ${newsDate.format('YYYY/MM/DD')}`,
|
|
24
|
+
link: url,
|
|
25
|
+
pubDate: timezone(parseDate(newsDate), +8),
|
|
26
|
+
description: await ctx.cache.tryGet(url, async () => {
|
|
27
|
+
const res = await got(url);
|
|
28
|
+
const content = cheerio.load(res.data);
|
|
29
|
+
const list = new Array();
|
|
30
|
+
content('body li').map((i, e) => {
|
|
31
|
+
e = content(e);
|
|
32
|
+
const href = e.find('a').attr('href');
|
|
33
|
+
const title = e.find('a').attr('title');
|
|
34
|
+
const dur = e.find('span').text();
|
|
35
|
+
list.push(`<a href="${href}">${title} ⏱${dur}</a>`);
|
|
36
|
+
return i;
|
|
37
|
+
});
|
|
38
|
+
return list.join('<br/>\n');
|
|
39
|
+
}),
|
|
40
|
+
};
|
|
41
|
+
return item;
|
|
42
|
+
})
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
ctx.state.data = {
|
|
46
|
+
title: 'CCTV 新闻联播',
|
|
47
|
+
link: 'http://tv.cctv.com/lm/xwlb/',
|
|
48
|
+
item: resultItems,
|
|
49
|
+
};
|
|
50
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
const cheerio = require('cheerio');
|
|
3
|
+
const utils = require('./utils');
|
|
4
|
+
|
|
5
|
+
module.exports = async (ctx) => {
|
|
6
|
+
const response = await got(`http://www.chinacef.cn/index.php/experts/zjmain/experts_id/${ctx.params.experts_id}`);
|
|
7
|
+
|
|
8
|
+
const data = response.data;
|
|
9
|
+
|
|
10
|
+
const $ = cheerio.load(data);
|
|
11
|
+
|
|
12
|
+
const domArray = $('div[class^="leftnews"]');
|
|
13
|
+
const rssTitle = $('title').text().trim();
|
|
14
|
+
|
|
15
|
+
const itemArray = await Promise.all(
|
|
16
|
+
domArray
|
|
17
|
+
.filter((index, item) => undefined !== $(item).find('h2 > a').attr('href'))
|
|
18
|
+
.map(async (index, item) => {
|
|
19
|
+
item = $(item);
|
|
20
|
+
const itemLink = utils.siteLink + item.find('h2 > a').attr('href');
|
|
21
|
+
const detail = await ctx.cache.tryGet(itemLink, async () => await utils.getArticleDetail(itemLink));
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
title: detail.title,
|
|
25
|
+
description: detail.description,
|
|
26
|
+
link: itemLink,
|
|
27
|
+
pubDate: detail.time,
|
|
28
|
+
author: detail.author,
|
|
29
|
+
};
|
|
30
|
+
})
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
ctx.state.data = {
|
|
34
|
+
title: rssTitle,
|
|
35
|
+
link: utils.siteLink,
|
|
36
|
+
item: itemArray,
|
|
37
|
+
};
|
|
38
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
const cheerio = require('cheerio');
|
|
3
|
+
const utils = require('./utils');
|
|
4
|
+
|
|
5
|
+
module.exports = async (ctx) => {
|
|
6
|
+
const response = await got.get('http://www.chinacef.cn/index.php/index/index');
|
|
7
|
+
|
|
8
|
+
const data = response.data;
|
|
9
|
+
|
|
10
|
+
const $ = cheerio.load(data);
|
|
11
|
+
|
|
12
|
+
const domArray = $('#boardright ul');
|
|
13
|
+
const rssTitle = '金融热点 - 首席经济学家论坛';
|
|
14
|
+
|
|
15
|
+
const itemArray = await Promise.all(
|
|
16
|
+
domArray
|
|
17
|
+
.map(async (index, item) => {
|
|
18
|
+
item = $(item);
|
|
19
|
+
const itemLink = utils.siteLink + item.find('li a').attr('href');
|
|
20
|
+
const detail = await ctx.cache.tryGet(itemLink, async () => await utils.getArticleDetail(itemLink));
|
|
21
|
+
|
|
22
|
+
return {
|
|
23
|
+
title: detail.title,
|
|
24
|
+
description: detail.description,
|
|
25
|
+
link: itemLink,
|
|
26
|
+
pubDate: detail.time,
|
|
27
|
+
author: detail.author,
|
|
28
|
+
};
|
|
29
|
+
})
|
|
30
|
+
.get()
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
ctx.state.data = {
|
|
34
|
+
title: rssTitle,
|
|
35
|
+
link: utils.siteLink,
|
|
36
|
+
item: itemArray,
|
|
37
|
+
};
|
|
38
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const utils = require('./utils');
|
|
2
|
+
const cheerio = require('cheerio');
|
|
3
|
+
const got = require('@/utils/got');
|
|
4
|
+
|
|
5
|
+
module.exports = async (ctx) => {
|
|
6
|
+
const rssTitle = '最新更新 - 首席经济学家论坛';
|
|
7
|
+
const regex = /^\/index\.php\/index\/article\/article_id\/\d+/g;
|
|
8
|
+
|
|
9
|
+
const response = await got.get('http://www.chinacef.cn/index.php/index/index');
|
|
10
|
+
const $ = cheerio.load(response.data);
|
|
11
|
+
|
|
12
|
+
const articlesLinkListNode = $('a[target=_black]')
|
|
13
|
+
.filter((_, item) => item.attribs.href.match(regex))
|
|
14
|
+
.map((_, item) => item.attribs.href);
|
|
15
|
+
const articlesLinkList = Array.from(new Set(articlesLinkListNode));
|
|
16
|
+
|
|
17
|
+
const articles = await Promise.all(
|
|
18
|
+
articlesLinkList.map(async (item) => {
|
|
19
|
+
const articlesLink = utils.siteLink + item;
|
|
20
|
+
|
|
21
|
+
const detail = await ctx.cache.tryGet(articlesLink, async () => await utils.getArticleDetail(articlesLink));
|
|
22
|
+
|
|
23
|
+
const element = {
|
|
24
|
+
title: detail.title,
|
|
25
|
+
author: detail.author,
|
|
26
|
+
pubDate: detail.time,
|
|
27
|
+
description: detail.description,
|
|
28
|
+
link: articlesLink,
|
|
29
|
+
};
|
|
30
|
+
return element;
|
|
31
|
+
})
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
ctx.state.data = {
|
|
35
|
+
title: rssTitle,
|
|
36
|
+
link: utils.siteLink,
|
|
37
|
+
item: articles,
|
|
38
|
+
};
|
|
39
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
'chinacef.cn': {
|
|
3
|
+
_name: '首席经济学家论坛',
|
|
4
|
+
'.': [
|
|
5
|
+
{
|
|
6
|
+
title: '最新文章列表',
|
|
7
|
+
docs: 'https://docs.rsshub.app/finance.html#shou-xi-jing-ji-xue-jia-lun-tan',
|
|
8
|
+
source: ['/'],
|
|
9
|
+
target: '/chinacef',
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
title: '专家文章',
|
|
13
|
+
docs: 'https://docs.rsshub.app/finance.html#shou-xi-jing-ji-xue-jia-lun-tan-zhuan-jia',
|
|
14
|
+
source: ['/index.php/experts/zjmain/experts_id/:experts_id'],
|
|
15
|
+
target: '/chinacef/:experts_id',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
title: '金融热点',
|
|
19
|
+
docs: 'https://docs.rsshub.app/finance.html#shou-xi-jing-ji-xue-jia-lun-tan-jin-rong-re-dian',
|
|
20
|
+
source: ['/index.php/index/index'],
|
|
21
|
+
target: '/chinacef/portal/hot',
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
const { art } = require('@/utils/render');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const cheerio = require('cheerio');
|
|
4
|
+
const got = require('@/utils/got');
|
|
5
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
6
|
+
|
|
7
|
+
const siteLink = 'http://www.chinacef.cn';
|
|
8
|
+
|
|
9
|
+
const renderDesc = (desc) =>
|
|
10
|
+
art(path.join(__dirname, 'templates/description.art'), {
|
|
11
|
+
desc,
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const cleanDom = (dom) => {
|
|
15
|
+
dom('*[style]').removeAttr('style');
|
|
16
|
+
dom('br').remove();
|
|
17
|
+
dom('span:empty').remove();
|
|
18
|
+
dom('p:empty').remove();
|
|
19
|
+
dom('p').each((_, el) => {
|
|
20
|
+
if (dom(el).html().trim() === '') {
|
|
21
|
+
dom(el).remove();
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
return dom;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const getArticleDetail = async (link) => {
|
|
28
|
+
const response = await got({
|
|
29
|
+
method: 'get',
|
|
30
|
+
url: link,
|
|
31
|
+
});
|
|
32
|
+
const $ = cleanDom(cheerio.load(response.data));
|
|
33
|
+
|
|
34
|
+
const title = $('span[class=contenttitle]').first().text().trim();
|
|
35
|
+
const author = $('a[rel=author]').first().text().trim();
|
|
36
|
+
const time = parseDate($('.divwidth').text().trim().split(' ')[3], 'YYYY-MM-DD');
|
|
37
|
+
const description = $('div[class=newsmaintext]').html();
|
|
38
|
+
return new ArticleDetail(title, author, time, renderDesc(description));
|
|
39
|
+
};
|
|
40
|
+
class ArticleDetail {
|
|
41
|
+
constructor(title, author, time, description) {
|
|
42
|
+
this.title = title;
|
|
43
|
+
this.author = author;
|
|
44
|
+
this.time = time;
|
|
45
|
+
this.description = description;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
module.exports = {
|
|
50
|
+
siteLink,
|
|
51
|
+
renderDesc,
|
|
52
|
+
cleanDom,
|
|
53
|
+
getArticleDetail,
|
|
54
|
+
ArticleDetail,
|
|
55
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
const timezone = require('@/utils/timezone');
|
|
3
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
4
|
+
const cheerio = require('cheerio');
|
|
5
|
+
|
|
6
|
+
const rootUrl = 'https://www.chinanews.com.cn';
|
|
7
|
+
|
|
8
|
+
module.exports = async (ctx) => {
|
|
9
|
+
const currentUrl = `${rootUrl}/scroll-news/news1.html`;
|
|
10
|
+
const response = await got({
|
|
11
|
+
method: 'get',
|
|
12
|
+
url: currentUrl,
|
|
13
|
+
});
|
|
14
|
+
const $ = cheerio.load(response.data);
|
|
15
|
+
const list = $('a', '.dd_bt')
|
|
16
|
+
.map((_, item) => ({
|
|
17
|
+
link: rootUrl + $(item).attr('href'),
|
|
18
|
+
title: $(item).text(),
|
|
19
|
+
}))
|
|
20
|
+
.get()
|
|
21
|
+
.slice(0, ctx.query.limit ? (parseInt(ctx.query.limit) > 125 ? 125 : parseInt(ctx.query.limit)) : 50);
|
|
22
|
+
|
|
23
|
+
const items = await Promise.all(
|
|
24
|
+
list.map((item) =>
|
|
25
|
+
ctx.cache.tryGet(item.link, async () => {
|
|
26
|
+
const detailResponse = await got({
|
|
27
|
+
method: 'get',
|
|
28
|
+
url: item.link,
|
|
29
|
+
});
|
|
30
|
+
const content = cheerio.load(detailResponse.data);
|
|
31
|
+
if (content('div.content_desc').length > 0) {
|
|
32
|
+
item.description = content('div.content_desc').text();
|
|
33
|
+
item.author = content('a.source').text();
|
|
34
|
+
const info = content('p', '.left').text().trim().slice(5).split(' ');
|
|
35
|
+
item.author = info[2].trim();
|
|
36
|
+
item.pubDate = timezone(parseDate(info[0] + info[1], 'YYYY年MM月DD日HH:mm'), +8);
|
|
37
|
+
} else if (content('div.t3').length > 0) {
|
|
38
|
+
item.description = content('div.t3').text();
|
|
39
|
+
const info = content('div[style="text-align:right;font-size:12px;"]').text().slice(5).split(' ');
|
|
40
|
+
item.author = info[2];
|
|
41
|
+
item.pubDate = timezone(parseDate(info[0] + info[1], 'YYYY-MM-DDHH:mm'), +8);
|
|
42
|
+
} else {
|
|
43
|
+
item.description = content('div.left_zw').text();
|
|
44
|
+
const info = content('div.left-t')
|
|
45
|
+
.contents()
|
|
46
|
+
.filter(function () {
|
|
47
|
+
return this.type === 'text';
|
|
48
|
+
})
|
|
49
|
+
.text()
|
|
50
|
+
.split(' ');
|
|
51
|
+
item.pubDate = timezone(parseDate(info[0], 'YYYY年MM月DD日 HH:mm'), +8);
|
|
52
|
+
item.author = info[1] + content('a.source').text();
|
|
53
|
+
}
|
|
54
|
+
return item;
|
|
55
|
+
})
|
|
56
|
+
)
|
|
57
|
+
);
|
|
58
|
+
ctx.state.data = {
|
|
59
|
+
title: '中国新闻网',
|
|
60
|
+
link: currentUrl,
|
|
61
|
+
description: '中国新闻网(简称“中新网”),由中国新闻社主办,为中央重点新闻网站。',
|
|
62
|
+
language: 'zh-cn',
|
|
63
|
+
item: items,
|
|
64
|
+
};
|
|
65
|
+
};
|
package/lib/v2/cnbeta/index.js
CHANGED
|
@@ -5,7 +5,8 @@ const { rootUrl, ProcessItems } = require('./utils');
|
|
|
5
5
|
module.exports = async (ctx) => {
|
|
6
6
|
const currentUrl = `${rootUrl}/backend.php`;
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
let { items } = await parser.parseURL(currentUrl);
|
|
9
|
+
items = items.filter((item) => item.link.includes('cnbeta'));
|
|
9
10
|
|
|
10
11
|
ctx.state.data = {
|
|
11
12
|
title: 'cnBeta',
|
package/lib/v2/cnbeta/utils.js
CHANGED
|
@@ -19,6 +19,7 @@ module.exports = {
|
|
|
19
19
|
content('.topic, .article-topic, .article-global').remove();
|
|
20
20
|
|
|
21
21
|
item.description = content('.article-summary').html() + content('.article-content').html();
|
|
22
|
+
item.author = content('header.title div.meta span.source').text();
|
|
22
23
|
|
|
23
24
|
return item;
|
|
24
25
|
})
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
'dapenti.com': {
|
|
3
|
+
_name: '喷嚏',
|
|
4
|
+
'.': [
|
|
5
|
+
{
|
|
6
|
+
title: '图卦',
|
|
7
|
+
docs: 'https://docs.rsshub.app/picture.html#pen-ti',
|
|
8
|
+
source: ['/blog/blog.asp'],
|
|
9
|
+
target: (params, url) => {
|
|
10
|
+
if (new URL(url).searchParams.get('subjectid') === '70') {
|
|
11
|
+
return '/dapenti/tugua';
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
title: '主题',
|
|
17
|
+
docs: 'https://docs.rsshub.app/picture.html#pen-ti',
|
|
18
|
+
source: ['/blog/blog.asp'],
|
|
19
|
+
target: (params, url) => {
|
|
20
|
+
if (new URL(url).searchParams.get('subjectid')) {
|
|
21
|
+
return '/dapenti/subject/' + new URL(url).searchParams.get('subjectid');
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
};
|