diff --git a/docs/university.md b/docs/university.md index 121d71f36..9f107d2cd 100644 --- a/docs/university.md +++ b/docs/university.md @@ -865,6 +865,28 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS +## 吉林工商学院 + +### 主页 + + + +| 学院新闻 | 通知公告 | 媒体工商 | 博学讲堂 | 师生风采 | +| -------- | -------- | -------- | -------- | -------- | +| xyxw | tzgg | mtgs | bxjt | ssfc | + + + +### 科研处 + + + +| 通知公告 | 新闻动态 | +| -------- | -------- | +| tzgg | xwdt | + + + ## 暨南大学 ## 暨南要闻 diff --git a/lib/router.js b/lib/router.js index 06832e461..150c22b5a 100644 --- a/lib/router.js +++ b/lib/router.js @@ -3920,6 +3920,10 @@ router.get('/tianyancha/hot', require('./routes/tianyancha/hot')); // King Arthur router.get('/kingarthur/:type', require('./routes/kingarthur/index')); +// 吉林工商学院 +router.get('/jlbtc/kyc/:category?', require('./routes/universities/jlbtc/kyc')); +router.get('/jlbtc/:category?', require('./routes/universities/jlbtc/index')); + // DT 财经 router.get('/dtcj/datahero/:category?', require('./routes/dtcj/datahero')); diff --git a/lib/routes/universities/jlbtc/index.js b/lib/routes/universities/jlbtc/index.js new file mode 100644 index 000000000..aa4c18986 --- /dev/null +++ b/lib/routes/universities/jlbtc/index.js @@ -0,0 +1,50 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); + +module.exports = async (ctx) => { + const category = ctx.params.category || 'tzgg'; + + const rootUrl = 'http://www.jlbtc.edu.cn'; + const currentUrl = `${rootUrl}/${category}.htm`; + const response = await got({ + method: 'get', + url: currentUrl, + }); + + const $ = cheerio.load(response.data); + + const list = $('.c44361') + .slice(0, 10) + .map((_, item) => { + item = $(item); + return { + title: item.text(), + link: `${rootUrl}/${item.attr('href')}`, + }; + }) + .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, #vsb_content_2, #vsb_content_501').html(); + item.pubDate = new Date(detailResponse.data.match(/发布日期:(.*) 供稿单位/)[1]).toUTCString(); + + return item; + }) + ) + ); + + ctx.state.data = { + title: $('title').text(), + link: currentUrl, + item: items, + }; +}; diff --git a/lib/routes/universities/jlbtc/kyc.js b/lib/routes/universities/jlbtc/kyc.js new file mode 100644 index 000000000..4f8adc2b4 --- /dev/null +++ b/lib/routes/universities/jlbtc/kyc.js @@ -0,0 +1,50 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); + +module.exports = async (ctx) => { + const category = ctx.params.category || 'tzgg'; + + const rootUrl = 'http://kyc.jlbtc.edu.cn'; + const currentUrl = `${rootUrl}/${category}.htm`; + const response = await got({ + method: 'get', + url: currentUrl, + }); + + const $ = cheerio.load(response.data); + + const list = $('.c48101') + .slice(0, 10) + .map((_, item) => { + item = $(item); + return { + title: item.text(), + link: `${rootUrl}/${item.attr('href')}`, + }; + }) + .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(); + item.pubDate = new Date(content('.timestyle45401').text()).toUTCString(); + + return item; + }) + ) + ); + + ctx.state.data = { + title: $('title').text(), + link: currentUrl, + item: items, + }; +};