mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-15 01:30:33 +08:00
fix(route): 重庆大学本科教学信息网 (原重庆大学教务网) (#7944)
This commit is contained in:
committed by
GitHub
parent
e71baee961
commit
b965e54298
@@ -303,9 +303,40 @@ pageClass: routes
|
|||||||
|
|
||||||
## 重庆大学
|
## 重庆大学
|
||||||
|
|
||||||
### 教务网通知公告
|
### 本科教学信息网通知公告
|
||||||
|
|
||||||
<Route author="El-Chiang" example="/cqu/jwc/announcement" path="/cqu/jwc/announcement"/>
|
<Route author="El-Chiang Hagb" example="/cqu/jwc/" path="/cqu/jwc/:path*" :paramsDesc="['路径']">
|
||||||
|
|
||||||
|
| 分类 | 路径 |
|
||||||
|
| ----------------------------------------------------------------- | ------------------- |
|
||||||
|
| [通知公告](http://jwc.cqu.edu.cn/index/tzgg.htm) | `index/tzgg` 或留空 |
|
||||||
|
| [通知公告 / 学籍管理](http://jwc.cqu.edu.cn/index/tzgg/xjgl.htm) | `index/tzgg/xjgl` |
|
||||||
|
| [通知公告 / 交流交换](http://jwc.cqu.edu.cn/index/tzgg/jljh1.htm) | `index/tzgg/jljh1` |
|
||||||
|
| [通知公告 / 教学运行](http://jwc.cqu.edu.cn/index/tzgg/jxyx.htm) | `index/tzgg/jxyx` |
|
||||||
|
| [通知公告 / 教学质量](http://jwc.cqu.edu.cn/index/tzgg/jxzl.htm) | `index/tzgg/jxzl` |
|
||||||
|
| [通知公告 / 教研教改](http://jwc.cqu.edu.cn/index/tzgg/jyjg.htm) | `index/tzgg/jyjg` |
|
||||||
|
| [通知公告 / 创新实践](http://jwc.cqu.edu.cn/index/tzgg/cxsj.htm) | `index/tzgg/cxsj` |
|
||||||
|
| [学籍管理 / 学籍处理](http://jwc.cqu.edu.cn/xjgl/xjcl.htm) | `xjgl/xjcl` |
|
||||||
|
| [学籍管理 / 交流交换](http://jwc.cqu.edu.cn/xjgl/jljh.htm) | `xjgl/jljh` |
|
||||||
|
| [学籍管理 / 学生推免](http://jwc.cqu.edu.cn/xjgl/xstm.htm) | `xjgl/xstm` |
|
||||||
|
| [学籍管理 / 转专业](http://jwc.cqu.edu.cn/xjgl/zzy.htm) | `xjgl/zzy` |
|
||||||
|
| [教学运行 / 学生选课](http://jwc.cqu.edu.cn/jxyx/xsxk.htm) | `jxyx/xsxk` |
|
||||||
|
| [教学运行 / 考试安排](http://jwc.cqu.edu.cn/jxyx/ksap.htm) | `jxyx/ksap` |
|
||||||
|
| [教学运行 / 助教管理](http://jwc.cqu.edu.cn/jxyx/zjgl.htm) | `jxyx/zjgl` |
|
||||||
|
|
||||||
|
</Route>
|
||||||
|
|
||||||
|
::: tip 提示
|
||||||
|
路径参数的值为相应通知列表页面的地址去除后缀名和域名后的路径。
|
||||||
|
|
||||||
|
例如 “通知公告” 列表页面地址为 <http://jwc.cqu.edu.cn/index/tzgg.htm>,相应参数为 `index/tgzz`。
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: warning 注意
|
||||||
|
原重庆大学教务网网站变更为重庆大学本科教学信息网。该路由编写时(2021-07-29)它[正处于试运行阶段](http://jwc.cqu.edu.cn/info/1080/3482.htm)。
|
||||||
|
|
||||||
|
通知的分类比较迷,请小心甄别、使用(以免漏掉需要的通知)。
|
||||||
|
:::
|
||||||
|
|
||||||
### 新闻网讲座预告
|
### 新闻网讲座预告
|
||||||
|
|
||||||
|
|||||||
@@ -744,7 +744,7 @@ router.get('/heu/uae/:type?', require('./routes/universities/heu/uae'));
|
|||||||
router.get('/heu/job/:type?', require('./routes/universities/heu/job'));
|
router.get('/heu/job/:type?', require('./routes/universities/heu/job'));
|
||||||
|
|
||||||
// 重庆大学
|
// 重庆大学
|
||||||
router.get('/cqu/jwc/announcement', require('./routes/universities/cqu/jwc/announcement'));
|
router.get('/cqu/jwc/:path*', require('./routes/universities/cqu/jwc/announcement'));
|
||||||
router.get('/cqu/news/jzyg', require('./routes/universities/cqu/news/jzyg'));
|
router.get('/cqu/news/jzyg', require('./routes/universities/cqu/news/jzyg'));
|
||||||
router.get('/cqu/news/tz', require('./routes/universities/cqu/news/tz'));
|
router.get('/cqu/news/tz', require('./routes/universities/cqu/news/tz'));
|
||||||
router.get('/cqu/youth/:category', require('./routes/universities/cqu/youth/info'));
|
router.get('/cqu/youth/:category', require('./routes/universities/cqu/youth/info'));
|
||||||
|
|||||||
@@ -1,35 +1,33 @@
|
|||||||
const got = require('@/utils/got');
|
const got = require('@/utils/got');
|
||||||
const cheerio = require('cheerio');
|
const cheerio = require('cheerio');
|
||||||
|
|
||||||
const baseUrl = 'http://jwc.cqu.edu.cn';
|
|
||||||
|
|
||||||
module.exports = async (ctx) => {
|
module.exports = async (ctx) => {
|
||||||
|
const category = ctx.params.path || 'index/tzgg';
|
||||||
|
const baseUrl = `http://jwc.cqu.edu.cn/${category.replace(/[^/]*$/, '')}`;
|
||||||
|
const url = `http://jwc.cqu.edu.cn/${category}.htm`;
|
||||||
const response = await got({
|
const response = await got({
|
||||||
method: 'get',
|
method: 'get',
|
||||||
url: 'http://jwc.cqu.edu.cn/announcement',
|
url: url,
|
||||||
headers: {
|
|
||||||
Referer: 'http://jwc.cqu.edu.cn/',
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
const { parseDate } = require('@/utils/parse-date');
|
||||||
const data = response.data;
|
const $ = cheerio.load(response.data);
|
||||||
const $ = cheerio.load(data);
|
const links = $('li.pot-r', 'div.page-contner.fl')
|
||||||
const links = $('.views-row a')
|
|
||||||
.slice(0, 5)
|
|
||||||
.map((index, item) => {
|
.map((index, item) => {
|
||||||
item = $(item);
|
item = $(item);
|
||||||
|
const a = item.find('a.no-wrap')[0];
|
||||||
return {
|
return {
|
||||||
title: item.text(),
|
date: parseDate(item.find('span.fr').text(), 'YYYY-MM-DD'),
|
||||||
link: baseUrl + item.attr('href'),
|
title: a.attribs.title,
|
||||||
|
link: baseUrl + a.attribs.href,
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
const items = await Promise.all(
|
const items = await Promise.all(
|
||||||
[...links].map(async ({ title, link }) => {
|
links.map(async ({ date, title, link }) => {
|
||||||
const item = {
|
const item = {
|
||||||
title: title,
|
title: title,
|
||||||
link: link,
|
link: link,
|
||||||
|
pubDate: date,
|
||||||
};
|
};
|
||||||
const cache = await ctx.cache.get(link);
|
const cache = await ctx.cache.get(link);
|
||||||
if (cache) {
|
if (cache) {
|
||||||
@@ -39,17 +37,17 @@ module.exports = async (ctx) => {
|
|||||||
method: 'get',
|
method: 'get',
|
||||||
url: link,
|
url: link,
|
||||||
});
|
});
|
||||||
const $ = cheerio.load(response.data);
|
|
||||||
item.author = $('.username').text();
|
const content = cheerio.load(response.data)('div#vsb_content', 'form[name=_newscontent_fromname]');
|
||||||
item.pubDate = $('time').attr('datetime');
|
item.description = content.find('div.v_news_content').html();
|
||||||
item.description = $('div .field-items').html() && $('div .field-items').find('p').text();
|
ctx.cache.set(item.link, item);
|
||||||
ctx.cache.set(item.link, JSON.stringify(item));
|
return item;
|
||||||
return Promise.resolve(item);
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
ctx.state.data = {
|
ctx.state.data = {
|
||||||
title: '重庆大学教务处通知公告',
|
title: $('title').text(),
|
||||||
link: 'http://jwc.cqu.edu.cn/announcement',
|
link: url,
|
||||||
|
description: $.title,
|
||||||
item: items.filter((x) => x),
|
item: items.filter((x) => x),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user