fix and feat: University/swufe/seie (#3022)

* fix: swufe/seie empty

* feat: add swufe/seie to radar-rules

* fix: swufe/seie 路径匹配问题
This commit is contained in:
Hivol 2019-09-08 12:53:59 +08:00 committed by DIYgod
parent b63d42a7dd
commit c54e2d4a99
2 changed files with 24 additions and 5 deletions

View File

@ -403,4 +403,21 @@
},
],
},
'swufe.edu.cn': {
_name: '西南财经大学',
it: [
{
title: '经济信息工程学院 - 通知公告',
docs: 'https://docs.rsshub.app/university.html#%E7%BB%8F%E6%B5%8E%E4%BF%A1%E6%81%AF%E5%B7%A5%E7%A8%8B%E5%AD%A6%E9%99%A2',
source: '/index/tzgg.htm',
target: '/universities/swufe/seie/tzgg',
},
{
title: '经济信息工程学院 - 学院新闻',
docs: 'https://docs.rsshub.app/university.html#%E7%BB%8F%E6%B5%8E%E4%BF%A1%E6%81%AF%E5%B7%A5%E7%A8%8B%E5%AD%A6%E9%99%A2',
source: '/index/xyxw.htm',
target: '/universities/swufe/seie/xyxw',
},
],
},
});

View File

@ -12,23 +12,25 @@ module.exports = async (ctx) => {
const suffix = map.get(type).suffix;
const link = listUrl + suffix;
const response = await got.get(link);
const data = response.data;
const $ = cheerio.load(data);
const list = $('div[class="article-list"] ul li a')
const list = $('.article-list li a')
.slice(0, 10)
.map(function() {
.map((_, elem) => {
const info = {
link: $(this)
link: $(elem)
.attr('href')
.slice(2),
title: $(this)
title: $(elem)
.children('span')
.first()
.text(),
date: $(this)
date: $(elem)
.children('span')
.last()
.text(),