mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-10 23:34:38 +08:00
feat: add 上海科技大学活动通知 (#4714)
This commit is contained in:
@@ -1144,6 +1144,10 @@ type 列表:
|
||||
|
||||
## 上海科技大学
|
||||
|
||||
### 活动通知
|
||||
|
||||
<Route author="nczitzk" example="/shanghaitech/activity" path="/shanghaitech/activity"/>
|
||||
|
||||
### 信息科技与技术学院活动
|
||||
|
||||
<Route author="HenryQW" example="/shanghaitech/sist/activity" path="/shanghaitech/sist/activity"/>
|
||||
|
||||
@@ -583,6 +583,7 @@ router.get('/hit/jwc', require('./routes/universities/hit/jwc'));
|
||||
router.get('/hit/today/:category', require('./routes/universities/hit/today'));
|
||||
|
||||
// 上海科技大学
|
||||
router.get('/shanghaitech/activity', require('./routes/universities/shanghaitech/activity'));
|
||||
router.get('/shanghaitech/sist/activity', require('./routes/universities/shanghaitech/sist/activity'));
|
||||
|
||||
// 上海交通大学
|
||||
|
||||
35
lib/routes/universities/shanghaitech/activity.js
Normal file
35
lib/routes/universities/shanghaitech/activity.js
Normal file
@@ -0,0 +1,35 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const link = 'http://www.shanghaitech.edu.cn/qb/list.htm';
|
||||
const response = await got({ method: 'get', url: link });
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const list = $('ul.news_list.clearfix li')
|
||||
.map((i, e) => ({
|
||||
link: `http://www.shanghaitech.edu.cn` + $(e).find('a').attr('href'),
|
||||
title: $(e).find('a').text(),
|
||||
pubDate: $(e).find('div.news_time').attr('data-time'),
|
||||
}))
|
||||
.get();
|
||||
|
||||
ctx.state.data = {
|
||||
title: '上海科技大学 - 活动',
|
||||
link: link,
|
||||
item: await Promise.all(
|
||||
list.map(
|
||||
async (item) =>
|
||||
await ctx.cache.tryGet(item.link, async () => {
|
||||
if (item.link.indexOf('_redirect?') === -1) {
|
||||
const detailResponse = await got({ method: 'get', url: item.link });
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
item.description = content('div.wp_articlecontent').html();
|
||||
}
|
||||
return item;
|
||||
})
|
||||
)
|
||||
),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user