rsshub 1.0.0-master.d3ce31d → 1.0.0-master.d4c8fa0
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/middleware/parameter.js +10 -4
- package/lib/radar-rules.js +20 -37
- package/lib/router.js +9 -9
- package/lib/v2/36kr/index.js +75 -0
- package/lib/v2/36kr/maintainer.js +7 -5
- package/lib/v2/36kr/radar.js +27 -15
- package/lib/v2/36kr/router.js +1 -5
- package/lib/v2/acs/journal.js +73 -0
- package/lib/v2/acs/maintainer.js +3 -0
- package/lib/v2/acs/radar.js +13 -0
- package/lib/v2/acs/router.js +3 -0
- package/lib/v2/acs/templates/description.art +2 -0
- package/lib/v2/airchina/index.js +36 -0
- package/lib/v2/airchina/maintainer.js +3 -0
- package/lib/v2/airchina/radar.js +13 -0
- package/lib/v2/airchina/router.js +3 -0
- package/lib/v2/allrecode/index.js +65 -0
- package/lib/v2/allrecode/maintainer.js +5 -0
- package/lib/v2/allrecode/news.js +35 -0
- package/lib/v2/allrecode/radar.js +25 -0
- package/lib/v2/allrecode/router.js +4 -0
- package/lib/v2/biquge/index.js +78 -0
- package/lib/v2/biquge/maintainer.js +3 -0
- package/lib/v2/biquge/radar.js +29 -0
- package/lib/v2/biquge/router.js +3 -0
- package/lib/v2/ccfcv/index.js +68 -0
- package/lib/v2/ccfcv/maintainer.js +3 -0
- package/lib/v2/ccfcv/radar.js +25 -0
- package/lib/v2/ccfcv/router.js +3 -0
- package/lib/v2/ccfcv/templates/description.art +1 -0
- package/lib/v2/cde/maintainer.js +1 -0
- package/lib/v2/cde/radar.js +12 -0
- package/lib/v2/cde/router.js +1 -0
- package/lib/v2/cde/zdyz.js +77 -0
- package/lib/v2/clash/maintainer.js +3 -0
- package/lib/v2/clash/premium.js +23 -0
- package/lib/v2/clash/radar.js +13 -0
- package/lib/v2/clash/router.js +3 -0
- package/lib/v2/gdut/maintainer.js +3 -0
- package/lib/{routes/universities → v2}/gdut/news.js +4 -0
- package/lib/v2/gdut/oa_news.js +214 -0
- package/lib/v2/gdut/radar.js +13 -0
- package/lib/v2/gdut/router.js +3 -0
- package/lib/v2/github/maintainer.js +1 -1
- package/lib/v2/github/templates/trending-description.art +5 -0
- package/lib/v2/github/trending.js +32 -16
- package/lib/v2/gov/maintainer.js +2 -0
- package/lib/v2/gov/moj/aac/news.js +49 -0
- package/lib/v2/gov/nifdc/index.js +86 -0
- package/lib/v2/gov/radar.js +22 -0
- package/lib/v2/gov/router.js +2 -0
- package/lib/v2/gov/shanghai/yjj/index.js +16 -10
- package/lib/v2/hakkatv/maintainer.js +3 -0
- package/lib/v2/hakkatv/radar.js +13 -0
- package/lib/v2/hakkatv/router.js +3 -0
- package/lib/v2/hakkatv/type.js +67 -0
- package/lib/v2/hk01/channel.js +13 -30
- package/lib/v2/hk01/hot.js +13 -14
- package/lib/v2/hk01/issue.js +12 -31
- package/lib/v2/hk01/maintainer.js +5 -5
- package/lib/v2/hk01/radar.js +19 -19
- package/lib/v2/hk01/router.js +4 -4
- package/lib/v2/hk01/tag.js +14 -15
- package/lib/v2/hk01/templates/description.art +53 -0
- package/lib/v2/hk01/utils.js +43 -0
- package/lib/v2/hk01/zone.js +15 -34
- package/lib/v2/houxu/events.js +37 -0
- package/lib/v2/houxu/index.js +21 -69
- package/lib/v2/houxu/lives.js +35 -0
- package/lib/v2/houxu/maintainer.js +4 -2
- package/lib/v2/houxu/memory.js +37 -0
- package/lib/v2/houxu/radar.js +18 -6
- package/lib/v2/houxu/router.js +6 -1
- package/lib/v2/houxu/templates/events.art +5 -0
- package/lib/v2/houxu/templates/lives.art +5 -0
- package/lib/v2/houxu/templates/memory.art +3 -0
- package/lib/v2/myfigurecollection/activity.js +58 -0
- package/lib/v2/myfigurecollection/index.js +78 -0
- package/lib/v2/myfigurecollection/maintainer.js +4 -0
- package/lib/v2/myfigurecollection/radar.js +44 -0
- package/lib/v2/myfigurecollection/router.js +4 -0
- package/lib/v2/myfigurecollection/templates/activity.art +8 -0
- package/lib/v2/myfigurecollection/templates/description.art +24 -0
- package/lib/v2/ncepu/maintainer.js +3 -0
- package/lib/v2/ncepu/master/masterinfo.js +78 -0
- package/lib/v2/ncepu/radar.js +25 -0
- package/lib/v2/ncepu/router.js +3 -0
- package/lib/{routes → v2}/nga/forum.js +8 -9
- package/lib/v2/nga/maintainer.js +4 -0
- package/lib/{routes → v2}/nga/post.js +16 -15
- package/lib/v2/nga/radar.js +56 -0
- package/lib/v2/nga/router.js +4 -0
- package/lib/v2/oo-software/changelog.js +40 -0
- package/lib/v2/oo-software/maintainer.js +3 -0
- package/lib/v2/oo-software/radar.js +13 -0
- package/lib/v2/oo-software/router.js +3 -0
- package/lib/{routes/outagereport/service.js → v2/outagereport/index.js} +2 -2
- package/lib/v2/outagereport/maintainer.js +3 -0
- package/lib/v2/outagereport/radar.js +13 -0
- package/lib/v2/outagereport/router.js +3 -0
- package/lib/v2/peopo/maintainer.js +3 -0
- package/lib/v2/peopo/radar.js +13 -0
- package/lib/v2/peopo/router.js +3 -0
- package/lib/v2/peopo/topic.js +46 -0
- package/lib/v2/pts/curations.js +44 -0
- package/lib/v2/pts/{dailynews.js → index.js} +24 -11
- package/lib/v2/pts/maintainer.js +6 -0
- package/lib/v2/pts/projects.js +44 -0
- package/lib/v2/pts/radar.js +38 -2
- package/lib/v2/pts/router.js +4 -1
- package/lib/v2/pts/templates/description.art +6 -0
- package/lib/v2/sakurazaka46/blog.js +1 -1
- package/lib/v2/sakurazaka46/maintainer.js +1 -0
- package/lib/v2/sakurazaka46/news.js +51 -0
- package/lib/v2/sakurazaka46/radar.js +6 -0
- package/lib/v2/sakurazaka46/router.js +1 -0
- package/lib/v2/scitation/journal.js +37 -50
- package/lib/v2/scitation/section.js +38 -56
- package/lib/v2/scitation/templates/description.art +4 -7
- package/lib/v2/scitation/utils.js +29 -0
- package/lib/v2/sinchew/index.js +68 -0
- package/lib/v2/sinchew/maintainer.js +5 -0
- package/lib/v2/sinchew/radar.js +25 -0
- package/lib/v2/sinchew/router.js +4 -0
- package/lib/v2/sinchew/templates/images.art +4 -0
- package/lib/v2/taiwannews/hot.js +52 -0
- package/lib/v2/taiwannews/maintainer.js +3 -0
- package/lib/v2/taiwannews/radar.js +13 -0
- package/lib/v2/taiwannews/router.js +3 -0
- package/lib/v2/test/index.js +2 -0
- package/lib/v2/tju/cic/index.js +113 -0
- package/lib/v2/tju/maintainer.js +6 -0
- package/lib/v2/tju/news/index.js +135 -0
- package/lib/v2/tju/oaa/index.js +112 -0
- package/lib/v2/tju/radar.js +97 -0
- package/lib/v2/tju/router.js +6 -0
- package/lib/v2/tju/yzb/index.js +121 -0
- package/lib/v2/tribalfootball/latest.js +68 -0
- package/lib/v2/tribalfootball/maintainer.js +3 -0
- package/lib/v2/tribalfootball/radar.js +13 -0
- package/lib/v2/tribalfootball/router.js +3 -0
- package/lib/v2/tribalfootball/templates/plus_header.art +6 -0
- package/lib/v2/youzhiyouxing/materials.js +5 -5
- package/lib/v2/zhihu/question.js +5 -3
- package/lib/v2/zhihu/router.js +1 -1
- package/lib/v2/zhihu/zhuanlan.js +2 -2
- package/package.json +19 -19
- package/lib/routes/universities/tjpyu/ooa.js +0 -73
- package/lib/v2/36kr/motif.js +0 -36
- package/lib/v2/36kr/news.js +0 -56
- package/lib/v2/36kr/newsflashes.js +0 -37
- package/lib/v2/36kr/search/article.js +0 -27
- package/lib/v2/36kr/user.js +0 -61
- package/lib/v2/houxu/templates/description.art +0 -9
package/lib/v2/test/index.js
CHANGED
|
@@ -23,6 +23,7 @@ module.exports = async (ctx) => {
|
|
|
23
23
|
pubDate: new Date(`2019-3-1`).toUTCString(),
|
|
24
24
|
link: `https://github.com/DIYgod/RSSHub/issues/-1`,
|
|
25
25
|
author: `DIYgod0`,
|
|
26
|
+
category: ['Category0', 'Category1'],
|
|
26
27
|
},
|
|
27
28
|
{
|
|
28
29
|
title: 'Filter Title2',
|
|
@@ -30,6 +31,7 @@ module.exports = async (ctx) => {
|
|
|
30
31
|
pubDate: new Date(`2019-3-1`).toUTCString(),
|
|
31
32
|
link: `https://github.com/DIYgod/RSSHub/issues/0`,
|
|
32
33
|
author: `DIYgod0`,
|
|
34
|
+
category: ['Category0', 'Category1', 'Category2'],
|
|
33
35
|
},
|
|
34
36
|
];
|
|
35
37
|
} else if (ctx.params.id === 'long') {
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
const cheerio = require('cheerio');
|
|
3
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
4
|
+
const timezone = require('@/utils/timezone');
|
|
5
|
+
|
|
6
|
+
const cic_base_url = 'http://cic.tju.edu.cn/';
|
|
7
|
+
const repo_url = 'https://github.com/DIYgod/RSSHub/issues';
|
|
8
|
+
|
|
9
|
+
const pageType = (href) => {
|
|
10
|
+
if (!href.startsWith('http')) {
|
|
11
|
+
return 'in-site';
|
|
12
|
+
}
|
|
13
|
+
const url = new URL(href);
|
|
14
|
+
if (url.hostname === 'cic.tju.edu.cn') {
|
|
15
|
+
return 'tju-cic';
|
|
16
|
+
} else {
|
|
17
|
+
return 'unknown';
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
module.exports = async (ctx) => {
|
|
22
|
+
const type = ctx.params && ctx.params.type;
|
|
23
|
+
let path, subtitle;
|
|
24
|
+
|
|
25
|
+
switch (type) {
|
|
26
|
+
case 'news':
|
|
27
|
+
subtitle = '学部新闻';
|
|
28
|
+
path = 'xwzx/xyxw.htm';
|
|
29
|
+
break;
|
|
30
|
+
case 'notification':
|
|
31
|
+
subtitle = '通知公告';
|
|
32
|
+
path = 'xwzx/tzgg.htm';
|
|
33
|
+
break;
|
|
34
|
+
case 'forum':
|
|
35
|
+
subtitle = '北洋智算论坛';
|
|
36
|
+
path = 'byzslt.htm';
|
|
37
|
+
break;
|
|
38
|
+
default:
|
|
39
|
+
subtitle = '学部新闻';
|
|
40
|
+
path = 'xwzx/xyxw.htm';
|
|
41
|
+
}
|
|
42
|
+
let response = null;
|
|
43
|
+
try {
|
|
44
|
+
response = await got(cic_base_url + path, {
|
|
45
|
+
headers: {
|
|
46
|
+
Referer: cic_base_url,
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
} catch (e) {
|
|
50
|
+
// ignore error handler
|
|
51
|
+
// console.log(e);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (response === null) {
|
|
55
|
+
ctx.state.data = {
|
|
56
|
+
title: '天津大学智能与计算学部 - ' + subtitle,
|
|
57
|
+
link: cic_base_url + path,
|
|
58
|
+
description: '链接失效' + cic_base_url + path,
|
|
59
|
+
item: [
|
|
60
|
+
{
|
|
61
|
+
title: '提示信息',
|
|
62
|
+
link: repo_url,
|
|
63
|
+
description: `<h2>请到<a href=${repo_url}>此处</a>提交Issue</h2>`,
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
};
|
|
67
|
+
} else {
|
|
68
|
+
const $ = cheerio.load(response.data);
|
|
69
|
+
const list = $('.wenzi_list_ul > li')
|
|
70
|
+
.map((_index, item) => {
|
|
71
|
+
const href = $('a', item).attr('href');
|
|
72
|
+
const type = pageType(href);
|
|
73
|
+
return {
|
|
74
|
+
title: $('a', item).text(),
|
|
75
|
+
link: type === 'in-site' ? cic_base_url + href : href,
|
|
76
|
+
type,
|
|
77
|
+
};
|
|
78
|
+
})
|
|
79
|
+
.get();
|
|
80
|
+
|
|
81
|
+
const items = await Promise.all(
|
|
82
|
+
list.map((item) => {
|
|
83
|
+
switch (item.type) {
|
|
84
|
+
case 'tju-cic':
|
|
85
|
+
case 'in-site':
|
|
86
|
+
return ctx.cache.tryGet(item.link, async () => {
|
|
87
|
+
let detailResponse = null;
|
|
88
|
+
try {
|
|
89
|
+
detailResponse = await got(item.link);
|
|
90
|
+
const content = cheerio.load(detailResponse.data);
|
|
91
|
+
item.pubDate = timezone(parseDate(content('.news_info > span').first().text(), 'YYYY年MM月DD日 HH:mm'), +8);
|
|
92
|
+
content('.news_tit').remove();
|
|
93
|
+
content('.news_info').remove();
|
|
94
|
+
item.description = content('.con_news_body > div').html();
|
|
95
|
+
} catch (e) {
|
|
96
|
+
// ignore error handler
|
|
97
|
+
}
|
|
98
|
+
return item;
|
|
99
|
+
});
|
|
100
|
+
default:
|
|
101
|
+
return item;
|
|
102
|
+
}
|
|
103
|
+
})
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
ctx.state.data = {
|
|
107
|
+
title: '天津大学智能与计算学部 - ' + subtitle,
|
|
108
|
+
link: cic_base_url + path,
|
|
109
|
+
description: null,
|
|
110
|
+
item: items,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
};
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
const cheerio = require('cheerio');
|
|
3
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
4
|
+
const timezone = require('@/utils/timezone');
|
|
5
|
+
|
|
6
|
+
const news_base_url = 'http://news.tju.edu.cn/';
|
|
7
|
+
const repo_url = 'https://github.com/DIYgod/RSSHub/issues';
|
|
8
|
+
|
|
9
|
+
const pageType = (href) => {
|
|
10
|
+
if (href === undefined) {
|
|
11
|
+
return 'unknown';
|
|
12
|
+
} else if (!href.startsWith('http')) {
|
|
13
|
+
return 'in-site';
|
|
14
|
+
}
|
|
15
|
+
const url = new URL(href);
|
|
16
|
+
if (url.hostname === 'news.tju.edu.cn') {
|
|
17
|
+
return 'tju-news';
|
|
18
|
+
} else {
|
|
19
|
+
return 'unknown';
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
module.exports = async (ctx) => {
|
|
24
|
+
const type = ctx.params && ctx.params.type;
|
|
25
|
+
let path, subtitle;
|
|
26
|
+
|
|
27
|
+
switch (type) {
|
|
28
|
+
case 'focus':
|
|
29
|
+
subtitle = '聚焦天大';
|
|
30
|
+
path = 'jjtd.htm';
|
|
31
|
+
break;
|
|
32
|
+
case 'general':
|
|
33
|
+
subtitle = '综合新闻';
|
|
34
|
+
path = 'zhxw.htm';
|
|
35
|
+
break;
|
|
36
|
+
case 'internal':
|
|
37
|
+
subtitle = '校内新闻';
|
|
38
|
+
path = 'xnxw1/qb.htm';
|
|
39
|
+
break;
|
|
40
|
+
case 'media':
|
|
41
|
+
subtitle = '媒体报道';
|
|
42
|
+
path = 'mtbd.htm';
|
|
43
|
+
break;
|
|
44
|
+
case 'picture':
|
|
45
|
+
subtitle = '图说天大';
|
|
46
|
+
path = 'tstd.htm';
|
|
47
|
+
break;
|
|
48
|
+
default:
|
|
49
|
+
subtitle = '聚焦天大';
|
|
50
|
+
path = 'jjtd.htm';
|
|
51
|
+
}
|
|
52
|
+
let response = null;
|
|
53
|
+
try {
|
|
54
|
+
response = await got(news_base_url + path, {
|
|
55
|
+
headers: {
|
|
56
|
+
Referer: news_base_url,
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
} catch (e) {
|
|
60
|
+
// ignore error handler
|
|
61
|
+
// console.log(e);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (response === null) {
|
|
65
|
+
ctx.state.data = {
|
|
66
|
+
title: '天津大学新闻网 - ' + subtitle,
|
|
67
|
+
link: news_base_url + path,
|
|
68
|
+
description: '链接失效' + news_base_url + path,
|
|
69
|
+
item: [
|
|
70
|
+
{
|
|
71
|
+
title: '提示信息',
|
|
72
|
+
link: repo_url,
|
|
73
|
+
description: `<h2>请到<a href=${repo_url}>此处</a>提交Issue</h2>`,
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
};
|
|
77
|
+
} else {
|
|
78
|
+
const $ = cheerio.load(response.data);
|
|
79
|
+
|
|
80
|
+
let list;
|
|
81
|
+
if (type === 'picture') {
|
|
82
|
+
list = $('.picList > li').get();
|
|
83
|
+
} else {
|
|
84
|
+
list = $('.indexList > li').get();
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
list = list.map((item) => {
|
|
88
|
+
const href = $('h4 > a', item).attr('href');
|
|
89
|
+
const type = pageType(href);
|
|
90
|
+
return {
|
|
91
|
+
title: $('h4 > a', item).text(),
|
|
92
|
+
link: type === 'in-site' ? news_base_url + href : href,
|
|
93
|
+
type,
|
|
94
|
+
};
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
const items = await Promise.all(
|
|
98
|
+
list.map((item) => {
|
|
99
|
+
switch (item.type) {
|
|
100
|
+
case 'tju-news':
|
|
101
|
+
case 'in-site':
|
|
102
|
+
return ctx.cache.tryGet(item.link, async () => {
|
|
103
|
+
let detailResponse = null;
|
|
104
|
+
try {
|
|
105
|
+
delete item.type;
|
|
106
|
+
detailResponse = await got(item.link);
|
|
107
|
+
const content = cheerio.load(detailResponse.data);
|
|
108
|
+
item.pubDate = timezone(
|
|
109
|
+
parseDate(
|
|
110
|
+
content('.contentTime')
|
|
111
|
+
.text()
|
|
112
|
+
.match(/\d{4}-\d{2}-\d{2}/)[0],
|
|
113
|
+
'YYYY-MM-DD'
|
|
114
|
+
),
|
|
115
|
+
+8
|
|
116
|
+
);
|
|
117
|
+
item.description = content('.v_news_content').html();
|
|
118
|
+
} catch (e) {
|
|
119
|
+
// ignore error handler
|
|
120
|
+
}
|
|
121
|
+
return item;
|
|
122
|
+
});
|
|
123
|
+
default:
|
|
124
|
+
return item;
|
|
125
|
+
}
|
|
126
|
+
})
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
ctx.state.data = {
|
|
130
|
+
title: '天津大学新闻网 - ' + subtitle,
|
|
131
|
+
link: news_base_url + path,
|
|
132
|
+
item: items,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
const cheerio = require('cheerio');
|
|
3
|
+
const { finishArticleItem } = require('@/utils/wechat-mp');
|
|
4
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
5
|
+
const timezone = require('@/utils/timezone');
|
|
6
|
+
|
|
7
|
+
const oaa_base_url = 'http://oaa.tju.edu.cn/';
|
|
8
|
+
const repo_url = 'https://github.com/DIYgod/RSSHub/issues';
|
|
9
|
+
|
|
10
|
+
const pageType = (href) => {
|
|
11
|
+
if (!href.startsWith('http')) {
|
|
12
|
+
return 'in-site';
|
|
13
|
+
}
|
|
14
|
+
const url = new URL(href);
|
|
15
|
+
if (url.hostname === 'mp.weixin.qq.com') {
|
|
16
|
+
return 'wechat-mp';
|
|
17
|
+
} else if (url.hostname === 'oaa.tju.edu.cn') {
|
|
18
|
+
return 'tju-oaa';
|
|
19
|
+
} else {
|
|
20
|
+
return 'unknown';
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
module.exports = async (ctx) => {
|
|
25
|
+
const type = ctx.params && ctx.params.type;
|
|
26
|
+
let path, subtitle;
|
|
27
|
+
|
|
28
|
+
switch (type) {
|
|
29
|
+
case 'news':
|
|
30
|
+
subtitle = '新闻动态';
|
|
31
|
+
path = 'xwdt.htm';
|
|
32
|
+
break;
|
|
33
|
+
case 'notification':
|
|
34
|
+
subtitle = '通知公告';
|
|
35
|
+
path = 'tzgg.htm';
|
|
36
|
+
break;
|
|
37
|
+
default:
|
|
38
|
+
subtitle = '新闻动态';
|
|
39
|
+
path = 'xwdt.htm';
|
|
40
|
+
}
|
|
41
|
+
let response = null;
|
|
42
|
+
try {
|
|
43
|
+
response = await got(oaa_base_url + path, {
|
|
44
|
+
headers: {
|
|
45
|
+
Referer: oaa_base_url,
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
} catch (e) {
|
|
49
|
+
// ignore error handler
|
|
50
|
+
// console.log(e);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (response === null) {
|
|
54
|
+
ctx.state.data = {
|
|
55
|
+
title: '天津大学教务处 - ' + subtitle,
|
|
56
|
+
link: oaa_base_url + path,
|
|
57
|
+
description: '链接失效' + oaa_base_url + path,
|
|
58
|
+
item: [
|
|
59
|
+
{
|
|
60
|
+
title: '提示信息',
|
|
61
|
+
link: repo_url,
|
|
62
|
+
description: `<h2>请到<a href=${repo_url}>此处</a>提交Issue</h2>`,
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
};
|
|
66
|
+
} else {
|
|
67
|
+
const $ = cheerio.load(response.data);
|
|
68
|
+
const list = $('.notice_l > ul > li > dl > dt')
|
|
69
|
+
.map((_index, item) => {
|
|
70
|
+
const href = $('a', item).attr('href');
|
|
71
|
+
const type = pageType(href);
|
|
72
|
+
return {
|
|
73
|
+
title: $('h2', item).text(),
|
|
74
|
+
link: type === 'in-site' ? oaa_base_url + href : href,
|
|
75
|
+
pubDate: timezone(parseDate($('.fl_01_r_time', item).text(), 'DDYYYY-MM'), +8),
|
|
76
|
+
type,
|
|
77
|
+
};
|
|
78
|
+
})
|
|
79
|
+
.get();
|
|
80
|
+
|
|
81
|
+
const items = await Promise.all(
|
|
82
|
+
list.map((item) => {
|
|
83
|
+
switch (item.type) {
|
|
84
|
+
case 'wechat-mp':
|
|
85
|
+
return finishArticleItem(ctx, item);
|
|
86
|
+
case 'tju-oaa':
|
|
87
|
+
case 'in-site':
|
|
88
|
+
return ctx.cache.tryGet(item.link, async () => {
|
|
89
|
+
let detailResponse = null;
|
|
90
|
+
try {
|
|
91
|
+
detailResponse = await got(item.link, { https: { rejectUnauthorized: false } });
|
|
92
|
+
const content = cheerio.load(detailResponse.data);
|
|
93
|
+
item.description = content('.v_news_content').html();
|
|
94
|
+
} catch (e) {
|
|
95
|
+
// ignore error handler
|
|
96
|
+
}
|
|
97
|
+
return item;
|
|
98
|
+
});
|
|
99
|
+
default:
|
|
100
|
+
return item;
|
|
101
|
+
}
|
|
102
|
+
})
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
ctx.state.data = {
|
|
106
|
+
title: '天津大学教务处 - ' + subtitle,
|
|
107
|
+
link: oaa_base_url + path,
|
|
108
|
+
description: null,
|
|
109
|
+
item: items,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
'tju.edu.cn': {
|
|
3
|
+
_name: '天津大学',
|
|
4
|
+
cic: [
|
|
5
|
+
{
|
|
6
|
+
title: '智能与计算学部 - 学部新闻',
|
|
7
|
+
docs: 'https://docs.rsshub.app/university.html#tian-jin-da-xue-zhi-neng-yu-ji-suan-xue-bu',
|
|
8
|
+
source: ['/xwzx/xyxw.htm', '/'],
|
|
9
|
+
target: '/tju/cic/news',
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
title: '智能与计算学部 - 通知公告',
|
|
13
|
+
docs: 'https://docs.rsshub.app/university.html#tian-jin-da-xue-zhi-neng-yu-ji-suan-xue-bu',
|
|
14
|
+
source: ['/xwzx/tzgg.htm', '/'],
|
|
15
|
+
target: '/tju/cic/notification',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
title: '智能与计算学部 - 北洋智算论坛',
|
|
19
|
+
docs: 'https://docs.rsshub.app/university.html#tian-jin-da-xue-zhi-neng-yu-ji-suan-xue-bu',
|
|
20
|
+
source: ['/byzslt.htm', '/'],
|
|
21
|
+
target: '/tju/cic/forum',
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
news: [
|
|
25
|
+
{
|
|
26
|
+
title: '新闻网 - 聚焦天大',
|
|
27
|
+
docs: 'https://docs.rsshub.app/university.html#tian-jin-da-xue-xin-wen-wang',
|
|
28
|
+
source: ['/jjtd.htm', '/'],
|
|
29
|
+
target: '/tju/news/focus',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
title: '新闻网 - 综合新闻',
|
|
33
|
+
docs: 'https://docs.rsshub.app/university.html#tian-jin-da-xue-xin-wen-wang',
|
|
34
|
+
source: ['/zhxw.htm', '/'],
|
|
35
|
+
target: '/tju/news/general',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
title: '新闻网 - 校内新闻',
|
|
39
|
+
docs: 'https://docs.rsshub.app/university.html#tian-jin-da-xue-xin-wen-wang',
|
|
40
|
+
source: ['/xnxw1/qb.htm', '/'],
|
|
41
|
+
target: '/tju/news/internal',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
title: '新闻网 - 媒体报道',
|
|
45
|
+
docs: 'https://docs.rsshub.app/university.html#tian-jin-da-xue-xin-wen-wang',
|
|
46
|
+
source: ['/mtbd.htm', '/'],
|
|
47
|
+
target: '/tju/news/media',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
title: '新闻网 - 图说天大',
|
|
51
|
+
docs: 'https://docs.rsshub.app/university.html#tian-jin-da-xue-xin-wen-wang',
|
|
52
|
+
source: ['/tstd.htm', '/'],
|
|
53
|
+
target: '/tju/news/picture',
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
oaa: [
|
|
57
|
+
{
|
|
58
|
+
title: '教务处 - 新闻动态',
|
|
59
|
+
docs: 'https://docs.rsshub.app/university.html#tian-jin-da-xue-jiao-wu-chu',
|
|
60
|
+
source: ['/xwdt.htm', '/'],
|
|
61
|
+
target: '/tju/oaa/news',
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
title: '教务处 - 通知公告',
|
|
65
|
+
docs: 'https://docs.rsshub.app/university.html#tian-jin-da-xue-jiao-wu-chu',
|
|
66
|
+
source: ['/tzgg.htm', '/'],
|
|
67
|
+
target: '/tju/oaa/notification',
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
yzb: [
|
|
71
|
+
{
|
|
72
|
+
title: '研究生招生网 - 校级公告',
|
|
73
|
+
docs: 'https://docs.rsshub.app/university.html#tian-jin-da-xue-yan-jiu-sheng-zhao-sheng-wang',
|
|
74
|
+
source: ['/xwzx/zxxx/', '/'],
|
|
75
|
+
target: '/tju/yzb/notice',
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
title: '研究生招生网 - 统考硕士',
|
|
79
|
+
docs: 'https://docs.rsshub.app/university.html#tian-jin-da-xue-yan-jiu-sheng-zhao-sheng-wang',
|
|
80
|
+
source: ['/xwzx/tkss_xw/', '/'],
|
|
81
|
+
target: '/tju/yzb/master',
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
title: '研究生招生网 - 统考博士',
|
|
85
|
+
docs: 'https://docs.rsshub.app/university.html#tian-jin-da-xue-yan-jiu-sheng-zhao-sheng-wang',
|
|
86
|
+
source: ['/xwzx/tkbs_xw/', '/'],
|
|
87
|
+
target: '/tju/yzb/doctor',
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
title: '研究生招生网 - 在职学位',
|
|
91
|
+
docs: 'https://docs.rsshub.app/university.html#tian-jin-da-xue-yan-jiu-sheng-zhao-sheng-wang',
|
|
92
|
+
source: ['/xwzx/zzxw/', '/'],
|
|
93
|
+
target: '/tju/yzb/job',
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
},
|
|
97
|
+
};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
const cheerio = require('cheerio');
|
|
3
|
+
const iconv = require('iconv-lite');
|
|
4
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
5
|
+
const timezone = require('@/utils/timezone');
|
|
6
|
+
|
|
7
|
+
const yzb_base_url = 'http://yzb.tju.edu.cn/';
|
|
8
|
+
const repo_url = 'https://github.com/DIYgod/RSSHub/issues';
|
|
9
|
+
|
|
10
|
+
const pageType = (href) => {
|
|
11
|
+
if (href === undefined) {
|
|
12
|
+
return 'unknown';
|
|
13
|
+
} else if (!href.startsWith('http')) {
|
|
14
|
+
return 'in-site';
|
|
15
|
+
}
|
|
16
|
+
const url = new URL(href);
|
|
17
|
+
if (url.hostname === 'yzb.tju.edu.cn') {
|
|
18
|
+
return 'tju-yzb';
|
|
19
|
+
} else {
|
|
20
|
+
return 'unknown';
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
module.exports = async (ctx) => {
|
|
25
|
+
const type = ctx.params && ctx.params.type;
|
|
26
|
+
let path, subtitle;
|
|
27
|
+
|
|
28
|
+
switch (type) {
|
|
29
|
+
case 'notice':
|
|
30
|
+
subtitle = '校级公告';
|
|
31
|
+
path = 'xwzx/zxxx/';
|
|
32
|
+
break;
|
|
33
|
+
case 'master':
|
|
34
|
+
subtitle = '统考硕士';
|
|
35
|
+
path = 'xwzx/tkss_xw/';
|
|
36
|
+
break;
|
|
37
|
+
case 'doctor':
|
|
38
|
+
subtitle = '统考博士';
|
|
39
|
+
path = 'xwzx/tkbs_xw/';
|
|
40
|
+
break;
|
|
41
|
+
case 'job':
|
|
42
|
+
subtitle = '在职学位';
|
|
43
|
+
path = 'xwzx/zzxw/';
|
|
44
|
+
break;
|
|
45
|
+
default:
|
|
46
|
+
subtitle = '校级公告';
|
|
47
|
+
path = 'xwzx/zxxx/';
|
|
48
|
+
}
|
|
49
|
+
let response = null;
|
|
50
|
+
try {
|
|
51
|
+
response = await got(yzb_base_url + path, {
|
|
52
|
+
headers: {
|
|
53
|
+
Referer: yzb_base_url,
|
|
54
|
+
},
|
|
55
|
+
responseType: 'buffer',
|
|
56
|
+
});
|
|
57
|
+
} catch (e) {
|
|
58
|
+
// ignore error handler
|
|
59
|
+
// console.log(e);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (response === null) {
|
|
63
|
+
ctx.state.data = {
|
|
64
|
+
title: '天津大学研究生招生网 - ' + subtitle,
|
|
65
|
+
link: yzb_base_url + path,
|
|
66
|
+
description: '链接失效' + yzb_base_url + path,
|
|
67
|
+
item: [
|
|
68
|
+
{
|
|
69
|
+
title: '提示信息',
|
|
70
|
+
link: repo_url,
|
|
71
|
+
description: `<h2>请到<a href=${repo_url}>此处</a>提交Issue</h2>`,
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
};
|
|
75
|
+
} else {
|
|
76
|
+
const $ = cheerio.load(iconv.decode(response.data, 'gbk'));
|
|
77
|
+
const list = $('body > table:nth-child(3) > tbody > tr > td.table_left_right > table > tbody > tr:nth-child(3) > td > table > tbody > tr:nth-child(1) > td > table > tbody > tr')
|
|
78
|
+
.slice(1, -1)
|
|
79
|
+
.map((_index, item) => {
|
|
80
|
+
const href = $('td > a', item).attr('href');
|
|
81
|
+
const type = pageType(href);
|
|
82
|
+
return {
|
|
83
|
+
title: $('td > a', item).text(),
|
|
84
|
+
link: type === 'in-site' ? yzb_base_url + path + href : href,
|
|
85
|
+
pubDate: timezone(parseDate($('.font_10_time', item).text().slice(2, -2), 'YYYY-MM-DD'), +8),
|
|
86
|
+
type,
|
|
87
|
+
};
|
|
88
|
+
})
|
|
89
|
+
.get();
|
|
90
|
+
|
|
91
|
+
const items = await Promise.all(
|
|
92
|
+
list.map((item) => {
|
|
93
|
+
switch (item.type) {
|
|
94
|
+
case 'tju-yzb':
|
|
95
|
+
case 'in-site':
|
|
96
|
+
return ctx.cache.tryGet(item.link, async () => {
|
|
97
|
+
let detailResponse = null;
|
|
98
|
+
try {
|
|
99
|
+
detailResponse = await got(item.link, { responseType: 'buffer' });
|
|
100
|
+
const content = cheerio.load(iconv.decode(detailResponse.data, 'gbk'));
|
|
101
|
+
content('.font_18_b').remove();
|
|
102
|
+
content('.font_grey_en').remove();
|
|
103
|
+
item.description = content('.nav_a10 > table > tbody').html();
|
|
104
|
+
} catch (e) {
|
|
105
|
+
// ignore error handler
|
|
106
|
+
}
|
|
107
|
+
return item;
|
|
108
|
+
});
|
|
109
|
+
default:
|
|
110
|
+
return item;
|
|
111
|
+
}
|
|
112
|
+
})
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
ctx.state.data = {
|
|
116
|
+
title: '天津大学研究生招生网 - ' + subtitle,
|
|
117
|
+
link: yzb_base_url + path,
|
|
118
|
+
item: items,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
const got = require('@/utils/got');
|
|
2
|
+
const { art } = require('@/utils/render');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const cheerio = require('cheerio');
|
|
5
|
+
const { parseDate } = require('@/utils/parse-date');
|
|
6
|
+
|
|
7
|
+
const rssUrl = 'https://www.tribalfootball.com/rss/mediafed/general/rss.xml';
|
|
8
|
+
|
|
9
|
+
module.exports = async (ctx) => {
|
|
10
|
+
const rss = await got(rssUrl);
|
|
11
|
+
const $ = cheerio.load(rss.data, { xmlMode: true });
|
|
12
|
+
const items = $('rss > channel > item')
|
|
13
|
+
.map((_, item) => {
|
|
14
|
+
const $item = $(item);
|
|
15
|
+
let link = $item.find('link').text();
|
|
16
|
+
link = new URL(link);
|
|
17
|
+
link.search = '';
|
|
18
|
+
link = link.href;
|
|
19
|
+
return {
|
|
20
|
+
title: $item.find('title').text(),
|
|
21
|
+
description: $item.find('description').text(),
|
|
22
|
+
link,
|
|
23
|
+
guid: $item.find('guid').text(),
|
|
24
|
+
pubDate: parseDate($item.find('pubDate').text()),
|
|
25
|
+
author: $item.find('dc\\:creator').text(),
|
|
26
|
+
_header_image: $item.find('enclosure').attr('url'),
|
|
27
|
+
};
|
|
28
|
+
})
|
|
29
|
+
.get();
|
|
30
|
+
|
|
31
|
+
await Promise.all(
|
|
32
|
+
items.map((item) =>
|
|
33
|
+
ctx.cache.tryGet(item.link, async () => {
|
|
34
|
+
const response = await got(item.link);
|
|
35
|
+
const $ = cheerio.load(response.data);
|
|
36
|
+
|
|
37
|
+
const title = $('head > title').text().replace(' - Tribal Football', '');
|
|
38
|
+
|
|
39
|
+
let desc = $('.articleBody');
|
|
40
|
+
desc.find('.ad').remove();
|
|
41
|
+
// <p><br><i>AD</i><span></span></p>
|
|
42
|
+
const ad = desc.find('p > br:first-child').next('i');
|
|
43
|
+
const adNextSpan = ad.next('span');
|
|
44
|
+
if (adNextSpan.length && !adNextSpan.text() && !adNextSpan.next().length) {
|
|
45
|
+
ad.parent().remove();
|
|
46
|
+
}
|
|
47
|
+
desc = desc.html();
|
|
48
|
+
desc = art(path.join(__dirname, 'templates/plus_header.art'), {
|
|
49
|
+
desc,
|
|
50
|
+
header_image: item._header_image,
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
item.title = title || item.title;
|
|
54
|
+
item.description = desc || item.description;
|
|
55
|
+
delete item._header_image;
|
|
56
|
+
return item;
|
|
57
|
+
})
|
|
58
|
+
)
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
ctx.state.data = {
|
|
62
|
+
title: 'Tribal Football - Latest',
|
|
63
|
+
description: 'Tribal Football - Football News, Soccer News, Transfers & Rumours',
|
|
64
|
+
link: 'https://www.tribalfootball.com/articles',
|
|
65
|
+
image: 'https://www.tribalfootball.com/images/tribal-logo-rss.png',
|
|
66
|
+
item: items,
|
|
67
|
+
};
|
|
68
|
+
};
|