From c54e2d4a9968ae33b7a5b4ccb8447eee739ce672 Mon Sep 17 00:00:00 2001 From: Hivol <31159723+Hivol@users.noreply.github.com> Date: Sun, 8 Sep 2019 12:53:59 +0800 Subject: [PATCH] fix and feat: University/swufe/seie (#3022) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: swufe/seie empty * feat: add swufe/seie to radar-rules * fix: swufe/seie 路径匹配问题 --- assets/radar-rules.js | 17 +++++++++++++++++ lib/routes/universities/swufe/seie/index.js | 12 +++++++----- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/assets/radar-rules.js b/assets/radar-rules.js index bcde96474..a311519ae 100644 --- a/assets/radar-rules.js +++ b/assets/radar-rules.js @@ -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', + }, + ], + }, }); diff --git a/lib/routes/universities/swufe/seie/index.js b/lib/routes/universities/swufe/seie/index.js index 7023fa11c..7950bf2db 100644 --- a/lib/routes/universities/swufe/seie/index.js +++ b/lib/routes/universities/swufe/seie/index.js @@ -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(),