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('/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/tz', require('./routes/universities/cqu/news/tz'));
|
||||
router.get('/cqu/youth/:category', require('./routes/universities/cqu/youth/info'));
|
||||
|
||||
@@ -1,35 +1,33 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
const baseUrl = 'http://jwc.cqu.edu.cn';
|
||||
|
||||
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({
|
||||
method: 'get',
|
||||
url: 'http://jwc.cqu.edu.cn/announcement',
|
||||
headers: {
|
||||
Referer: 'http://jwc.cqu.edu.cn/',
|
||||
},
|
||||
url: url,
|
||||
});
|
||||
|
||||
const data = response.data;
|
||||
const $ = cheerio.load(data);
|
||||
const links = $('.views-row a')
|
||||
.slice(0, 5)
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const $ = cheerio.load(response.data);
|
||||
const links = $('li.pot-r', 'div.page-contner.fl')
|
||||
.map((index, item) => {
|
||||
item = $(item);
|
||||
const a = item.find('a.no-wrap')[0];
|
||||
return {
|
||||
title: item.text(),
|
||||
link: baseUrl + item.attr('href'),
|
||||
date: parseDate(item.find('span.fr').text(), 'YYYY-MM-DD'),
|
||||
title: a.attribs.title,
|
||||
link: baseUrl + a.attribs.href,
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
const items = await Promise.all(
|
||||
[...links].map(async ({ title, link }) => {
|
||||
links.map(async ({ date, title, link }) => {
|
||||
const item = {
|
||||
title: title,
|
||||
link: link,
|
||||
pubDate: date,
|
||||
};
|
||||
const cache = await ctx.cache.get(link);
|
||||
if (cache) {
|
||||
@@ -39,17 +37,17 @@ module.exports = async (ctx) => {
|
||||
method: 'get',
|
||||
url: link,
|
||||
});
|
||||
const $ = cheerio.load(response.data);
|
||||
item.author = $('.username').text();
|
||||
item.pubDate = $('time').attr('datetime');
|
||||
item.description = $('div .field-items').html() && $('div .field-items').find('p').text();
|
||||
ctx.cache.set(item.link, JSON.stringify(item));
|
||||
return Promise.resolve(item);
|
||||
|
||||
const content = cheerio.load(response.data)('div#vsb_content', 'form[name=_newscontent_fromname]');
|
||||
item.description = content.find('div.v_news_content').html();
|
||||
ctx.cache.set(item.link, item);
|
||||
return item;
|
||||
})
|
||||
);
|
||||
ctx.state.data = {
|
||||
title: '重庆大学教务处通知公告',
|
||||
link: 'http://jwc.cqu.edu.cn/announcement',
|
||||
title: $('title').text(),
|
||||
link: url,
|
||||
description: $.title,
|
||||
item: items.filter((x) => x),
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user