mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-16 02:42:57 +08:00
增加 西南科技大学 教务处/学院 通知 (#475)
This commit is contained in:
@@ -199,6 +199,9 @@ RSSHub 是一个轻量、易于扩展的 RSS 生成器,可以给任何奇奇
|
||||
- 教务处通知
|
||||
- 图书馆通知
|
||||
- 计算机学院竞赛通知
|
||||
- 西南科技大学
|
||||
- 教务处通知
|
||||
- 计科学院通知
|
||||
- Keep
|
||||
- 运动日记
|
||||
- 起点
|
||||
|
||||
@@ -1424,6 +1424,24 @@ id, 专辑 id, 可在对应专辑页面的 URL 中找到
|
||||
|
||||
参数: type,1 为教务新闻,2 为教务公告
|
||||
|
||||
## 西南科技大学
|
||||
|
||||
### 教务处通知 <Author uid="lengthmin"/>
|
||||
|
||||
举例: [https://rsshub.app/swust/jwc/1](https://rsshub.app/swust/jwc/1)
|
||||
|
||||
路由: `/swust/jwc/:type`
|
||||
|
||||
参数: type, 1 为通知公告, 2 为站点新闻
|
||||
|
||||
### 计科学院通知 <Author uid="lengthmin"/>
|
||||
|
||||
举例: [https://rsshub.app/swust/cs/1](https://rsshub.app/swust/cs/1)
|
||||
|
||||
路由: `swust/cs/:type`
|
||||
|
||||
参数: type, 1 为新闻动态, 2 为学术动态, 3 为通知公告, 4 为教研动态
|
||||
|
||||
## 新京报
|
||||
|
||||
### 栏目 <Author uid="zhboner"/>
|
||||
|
||||
@@ -310,6 +310,10 @@ router.get('/shmtu/events', require('./routes/shmtu/events'));
|
||||
router.get('/shmtu/notes', require('./routes/shmtu/notes'));
|
||||
router.get('/shmtu/jwc/:type', require('./routes/shmtu/jwc'));
|
||||
|
||||
// SWUST
|
||||
router.get('/swust/jwc/:type', require('./routes/swust/jwc'));
|
||||
router.get('/swust/cs/:type', require('./routes/swust/cs'));
|
||||
|
||||
// 新京报
|
||||
router.get('/bjnews/:cat', require('./routes/bjnews/news'));
|
||||
|
||||
|
||||
68
routes/swust/cs.js
Normal file
68
routes/swust/cs.js
Normal file
@@ -0,0 +1,68 @@
|
||||
const axios = require('../../utils/axios');
|
||||
const cheerio = require('cheerio');
|
||||
const config = require('../../config');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const host = 'http://www.cs.swust.edu.cn/';
|
||||
let type = ctx.params.type;
|
||||
let info = '新闻动态';
|
||||
let word = 'news';
|
||||
if (type === '2') {
|
||||
info = '学术动态';
|
||||
word = 'academic';
|
||||
} else if (type === '3') {
|
||||
info = '通知公告';
|
||||
word = 'notice';
|
||||
} else if (type === '4') {
|
||||
info = '教研动态';
|
||||
word = 'Teach_Research';
|
||||
} else {
|
||||
type = '1';
|
||||
}
|
||||
|
||||
const response = await axios({
|
||||
method: 'get',
|
||||
url: host + word,
|
||||
headers: {
|
||||
'User-Agent': config.ua,
|
||||
Referer: host,
|
||||
},
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const text = $('a', '.list.list3');
|
||||
|
||||
ctx.state.data = {
|
||||
title: `西南科技大学 计科学院 ${info}`,
|
||||
link: host + word,
|
||||
description: `西南科技大学 计科学院 ${info}`,
|
||||
item:
|
||||
text &&
|
||||
text
|
||||
.map((index, item) => {
|
||||
item = $(item);
|
||||
return {
|
||||
title: $('.imgdesc', item)
|
||||
.find('.imgtitle')
|
||||
.text(),
|
||||
description: $('.imgdesc', item)
|
||||
.find('.imgtext')
|
||||
.text(),
|
||||
pubDate: new Date(
|
||||
Date.parse(
|
||||
$('.imgdesc', item)
|
||||
.contents()
|
||||
.filter(function() {
|
||||
return this.nodeType === 3;
|
||||
})
|
||||
.text()
|
||||
.replace('[', '')
|
||||
.replace(']', '')
|
||||
)
|
||||
),
|
||||
link: host + item.attr('href'),
|
||||
};
|
||||
})
|
||||
.get(),
|
||||
};
|
||||
};
|
||||
65
routes/swust/jwc.js
Normal file
65
routes/swust/jwc.js
Normal file
@@ -0,0 +1,65 @@
|
||||
const axios = require('../../utils/axios');
|
||||
const cheerio = require('cheerio');
|
||||
const config = require('../../config');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const host = 'http://www.dean.swust.edu.cn';
|
||||
let type = ctx.params.type;
|
||||
|
||||
let info = '通知公告';
|
||||
let word = 'notices/';
|
||||
|
||||
if (type === '2') {
|
||||
info = '站点新闻';
|
||||
word = 'news/';
|
||||
} else {
|
||||
type = '1';
|
||||
}
|
||||
|
||||
const web = 'http://www.dean.swust.edu.cn/xml/' + word + 'index.xml';
|
||||
const response = await axios({
|
||||
method: 'get',
|
||||
url: web,
|
||||
headers: {
|
||||
'User-Agent': config.ua,
|
||||
Referer: host,
|
||||
},
|
||||
});
|
||||
|
||||
const data = response.data;
|
||||
|
||||
const $ = cheerio.load(data, {
|
||||
xmlMode: true,
|
||||
});
|
||||
const list = $('entrity');
|
||||
|
||||
ctx.state.data = {
|
||||
title: '西南科技大学 教务处 ' + info,
|
||||
link: web,
|
||||
description: $('title')
|
||||
.first()
|
||||
.text(),
|
||||
item:
|
||||
list &&
|
||||
list
|
||||
.map((index, item) => {
|
||||
item = $(item);
|
||||
return {
|
||||
title: item.find('title').text(),
|
||||
description: item.find('summary').text(),
|
||||
pubDate: new Date(
|
||||
Date.parse(
|
||||
item
|
||||
.find('date')
|
||||
.text()
|
||||
.replace('年', '-')
|
||||
.replace('月', '-')
|
||||
.replace('日', '')
|
||||
)
|
||||
),
|
||||
link: host + '/xml/' + word + item.attr('id') + '.xml',
|
||||
};
|
||||
})
|
||||
.get(),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user