feat: add 吉林工商学院主页 & 科研处 (#6888)

Co-authored-by: NeverBehave <gayhub@never.pet>
This commit is contained in:
Ethan Shen 2021-02-14 02:54:00 +08:00 committed by GitHub
parent ce7e458910
commit 20ddf80596
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 126 additions and 0 deletions

View File

@ -865,6 +865,28 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS
<Route author="276562578" example="/jlu/oa" path="/jlu" />
## 吉林工商学院
### 主页
<Route author="nczitzk" example="/jlbtc" path="/jlbtc/:category?" :paramDesc="['分类,见下表,默认为通知公告']">
| 学院新闻 | 通知公告 | 媒体工商 | 博学讲堂 | 师生风采 |
| -------- | -------- | -------- | -------- | -------- |
| xyxw | tzgg | mtgs | bxjt | ssfc |
</Route>
### 科研处
<Route author="nczitzk" example="/jlbtc/kyc" path="/jlbtc/kyc/:category?" :paramDesc="['分类,见下表,默认为通知公告']">
| 通知公告 | 新闻动态 |
| -------- | -------- |
| tzgg | xwdt |
</Route>
## 暨南大学
## 暨南要闻

View File

@ -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'));

View File

@ -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(/发布日期:(.*)&nbsp;供稿单位/)[1]).toUTCString();
return item;
})
)
);
ctx.state.data = {
title: $('title').text(),
link: currentUrl,
item: items,
};
};

View File

@ -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,
};
};