mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-11 07:40:26 +08:00
feat: 增加四川大学学工部通知公告 (#3062)
This commit is contained in:
@@ -830,6 +830,10 @@ https://rsshub.app/**nuist**/`bulletin` 或 https://rsshub.app/**nuist**/`bullet
|
|||||||
|
|
||||||
<Route author="KXXH" example="/scu/jwc/notice" path="/scu/jwc/notice" />
|
<Route author="KXXH" example="/scu/jwc/notice" path="/scu/jwc/notice" />
|
||||||
|
|
||||||
|
### 学工部通知公告
|
||||||
|
|
||||||
|
<Route author="stevelee477" example="/scu/xg/notice" path="/scu/xg/notice" />
|
||||||
|
|
||||||
## 四川旅游学院
|
## 四川旅游学院
|
||||||
|
|
||||||
### 信息与工程学院动态公告列表
|
### 信息与工程学院动态公告列表
|
||||||
|
|||||||
@@ -1180,6 +1180,7 @@ router.get('/babykingdom/:id/:order?', require('./routes/babykingdom'));
|
|||||||
|
|
||||||
// 四川大学
|
// 四川大学
|
||||||
router.get('/scu/jwc/notice', require('./routes/universities/scu/jwc'));
|
router.get('/scu/jwc/notice', require('./routes/universities/scu/jwc'));
|
||||||
|
router.get('/scu/xg/notice', require('./routes/universities/scu/xg'));
|
||||||
|
|
||||||
// 浙江工商大学
|
// 浙江工商大学
|
||||||
router.get('/zjgsu/tzgg', require('./routes/universities/zjgsu/tzgg/scripts'));
|
router.get('/zjgsu/tzgg', require('./routes/universities/zjgsu/tzgg/scripts'));
|
||||||
|
|||||||
50
lib/routes/universities/scu/xg.js
Normal file
50
lib/routes/universities/scu/xg.js
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
const got = require('@/utils/got');
|
||||||
|
const cheerio = require('cheerio');
|
||||||
|
|
||||||
|
async function load_detail(list, cache) {
|
||||||
|
return await Promise.all(
|
||||||
|
list.map(async (item) => {
|
||||||
|
const notice_item = cheerio.load(item);
|
||||||
|
const url = 'http://xsc.scu.edu.cn' + notice_item('a').attr('href');
|
||||||
|
return await cache.tryGet(url, async () => {
|
||||||
|
const detail_response = await got({
|
||||||
|
method: 'get',
|
||||||
|
url: url,
|
||||||
|
headers: {
|
||||||
|
Referer: 'http://xsc.scu.edu.cn/WEBSITE/XG',
|
||||||
|
Host: 'xsc.scu.edu.cn',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const detail = cheerio.load(detail_response.data);
|
||||||
|
return {
|
||||||
|
title: notice_item('a').attr('title'),
|
||||||
|
description: detail('.news-content').html(),
|
||||||
|
link: url,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const response = await got({
|
||||||
|
method: 'get',
|
||||||
|
url: 'http://xsc.scu.edu.cn/WEBSITE/XG',
|
||||||
|
headers: {
|
||||||
|
Host: 'xsc.scu.edu.cn',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const data = response.data;
|
||||||
|
|
||||||
|
const $ = cheerio.load(data);
|
||||||
|
const list = $('.news-pannel.notice-news > .news-body > .news-list > ul > li').get();
|
||||||
|
|
||||||
|
const detail = await load_detail(list, ctx.cache);
|
||||||
|
|
||||||
|
ctx.state.data = {
|
||||||
|
title: '四川大学学工部 - 通知公告',
|
||||||
|
link: 'http://xsc.scu.edu.cn/WEBSITE/XG',
|
||||||
|
item: detail,
|
||||||
|
};
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user