mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
feat: /lsnu/jiaowc/tzgg/:category? 乐山师范学院教学部通知公告
This commit is contained in:
+19
-20
@@ -2,9 +2,12 @@ const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const category = ctx.params.category;
|
||||
const url = category ? `http://jiaowc.lsnu.edu.cn/tzgg/${category}.htm` : 'http://jiaowc.lsnu.edu.cn/tzgg.htm';
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: 'http://jiaowc.lsnu.edu.cn/tzgg.htm',
|
||||
url,
|
||||
});
|
||||
|
||||
const data = response.data;
|
||||
@@ -19,28 +22,24 @@ module.exports = async (ctx) => {
|
||||
const link = 'http://jiaowc.lsnu.edu.cn/' + $('a').attr('href');
|
||||
const date = $('td[width="80"]').text();
|
||||
|
||||
const cache = await ctx.cache.get(link);
|
||||
if (cache) {
|
||||
return JSON.parse(cache);
|
||||
}
|
||||
const single = await ctx.cache.tryGet(link, async () => {
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: link,
|
||||
});
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: link,
|
||||
const articleData = response.data;
|
||||
const article$ = cheerio.load(articleData);
|
||||
const description = article$('.v_news_content').html();
|
||||
|
||||
return {
|
||||
title,
|
||||
link,
|
||||
description,
|
||||
pubDate: new Date(date).toUTCString(),
|
||||
};
|
||||
});
|
||||
|
||||
const articleData = response.data;
|
||||
const article$ = cheerio.load(articleData);
|
||||
const description = article$('.v_news_content').html();
|
||||
|
||||
const single = {
|
||||
title,
|
||||
link,
|
||||
description,
|
||||
pubDate: new Date(date).toUTCString(),
|
||||
};
|
||||
|
||||
ctx.cache.set(link, JSON.stringify(single));
|
||||
return Promise.resolve(single);
|
||||
})
|
||||
);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
module.exports = {
|
||||
'jiaowc.lsnu.edu.cn': {
|
||||
_name: '乐山师范学院教学部',
|
||||
'lsnu.edu.cn': {
|
||||
_name: '乐山师范学院',
|
||||
'.': [
|
||||
{
|
||||
title: '通知公告',
|
||||
docs: 'https://docs.rsshub.app/',
|
||||
title: '教学部通知公告',
|
||||
docs: 'https://docs.rsshub.app/university.html#le-shan-shi-fan-xue-yuan',
|
||||
source: ['/'],
|
||||
target: '/lsnu/jiaowc/tzgg',
|
||||
},
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module.exports = (router) => {
|
||||
router.get('/jiaowc/tzgg', require('./jiaowc/tzgg'));
|
||||
router.get('/jiaowc/tzgg/:category?', require('./jiaowc/tzgg'));
|
||||
};
|
||||
|
||||
@@ -2013,7 +2013,15 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS
|
||||
|
||||
### 教学部通知公告 {#le-shan-shi-fan-xue-yuan-jiao-xue-bu-tong-zhi-gong-gao}
|
||||
|
||||
<Route author="nyaShine" example="/lsnu/jiaowc/tzgg" path="/lsnu/jiaowc/tzgg" radar="1" />
|
||||
<Route author="nyaShine" example="/lsnu/jiaowc/tzgg" path="/lsnu/jiaowc/tzgg/:category?" paramsDesc={['分类名']} radar="1" />
|
||||
|
||||
category 列表:
|
||||
|
||||
| 实践教学科 | 教育运行科 | 教研教改科 | 学籍管理科 | 考试科 | 教材建设管理科 |
|
||||
| -------- | -------- | -------- | -------- | -------- | -------- |
|
||||
| sjjxk | jxyxk | jyjgk | xjglk | ksk | jcjsglk |
|
||||
|
||||
</Route>
|
||||
|
||||
## 辽宁工程技术大学 {#liao-ning-gong-cheng-ji-shu-da-xue}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user