mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
feat: add 四川职业技术学院学院公告 (#5304)
This commit is contained in:
@@ -1409,6 +1409,12 @@ type 列表:
|
||||
|
||||
<Route author="talenHuang" example="/sctu/jwc/13/645" path="/sctu/jwc/context/:type/:id" :paramsDesc="['通知类型','文章id']"/>
|
||||
|
||||
## 四川职业技术学院
|
||||
|
||||
### 学院公告
|
||||
|
||||
<Route author="nczitzk" example="/scvtc/xygg" path="/scvtc/xygg" />
|
||||
|
||||
## 天津大学
|
||||
|
||||
### 天津大学教务处
|
||||
|
||||
@@ -3040,6 +3040,9 @@ router.get('/hfut/tzgg', require('./routes/universities/hfut/tzgg'));
|
||||
// Darwin Awards
|
||||
router.get('/darwinawards/all', require('./routes/darwinawards/articles'));
|
||||
|
||||
// 四川职业技术学院
|
||||
router.get('/scvtc/xygg', require('./routes/universities/scvtc/xygg'));
|
||||
|
||||
// OneJAV
|
||||
router.get('/onejav/:type/:key?', require('./routes/onejav/one'));
|
||||
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
const url = require('url');
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const currentUrl = 'http://scvtc.edu.cn/ggfw1/xygg.htm';
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: currentUrl,
|
||||
});
|
||||
const $ = cheerio.load(response.data);
|
||||
const list = $('div.list_l div ul li')
|
||||
.map((_, item) => {
|
||||
item = $(item);
|
||||
const a = item.find('a[title]');
|
||||
return {
|
||||
title: a.text(),
|
||||
link: url.resolve(currentUrl, a.attr('href')),
|
||||
pubDate: new Date(item.find('span.c43271_date').text().split(' ')[0].trim()).toUTCString(),
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
const items = await Promise.all(
|
||||
list.map(
|
||||
async (item) =>
|
||||
await ctx.cache.tryGet(item.link, async () => {
|
||||
const detailResponse = await got({
|
||||
method: 'get',
|
||||
url: item.link,
|
||||
});
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
|
||||
item.description = content('#vsb_content').html();
|
||||
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: '四川职业技术学院 - 学院公告',
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user