fix(route): cqwu (#13654)
This commit is contained in:
parent
bd6528e9a9
commit
3bd51e37be
|
|
@ -4,8 +4,8 @@ const { parseDate } = require('@/utils/parse-date');
|
|||
|
||||
const host = 'https://www.cqwu.edu.cn';
|
||||
const map = {
|
||||
notify: '/channel_7721.html',
|
||||
academiceve: '/channel_7722.html',
|
||||
notify: '/channel_24894.html',
|
||||
academiceve: '/channel_24895.html',
|
||||
};
|
||||
const titleMap = {
|
||||
notify: '通知',
|
||||
|
|
@ -18,22 +18,25 @@ module.exports = async (ctx) => {
|
|||
const title = '重文理' + titleMap[type] + '公告';
|
||||
const response = await got.get(link);
|
||||
const $ = cheerio.load(response.data);
|
||||
const list = $('ul[class="list-unstyled news-uls"]').find('li');
|
||||
const list = $('div[class="list"] ul').find('li');
|
||||
|
||||
const items = await Promise.all(
|
||||
list.map(async (_, item) => {
|
||||
list.map(async (i, item) => {
|
||||
const pageUrl = host + $(item).find('a').attr('href');
|
||||
const desc = await ctx.cache.tryGet(pageUrl, async () => {
|
||||
const { desc, pubDate } = await ctx.cache.tryGet(pageUrl, async () => {
|
||||
const page = await got.get(pageUrl);
|
||||
const $ = cheerio.load(page.data);
|
||||
return $('.news-info').html();
|
||||
return {
|
||||
desc: $('.contentAtice').html(),
|
||||
pubDate: parseDate($('.abs span:nth-child(1)').text().replace('发布时间:', '')),
|
||||
};
|
||||
});
|
||||
|
||||
return {
|
||||
title: $(item).find('a').text(),
|
||||
title: $(item).find('.title').text(),
|
||||
link: pageUrl,
|
||||
description: desc,
|
||||
pubDate: parseDate($(item).find('span').text()),
|
||||
pubDate,
|
||||
};
|
||||
})
|
||||
);
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ module.exports = {
|
|||
docs: 'https://docs.rsshub.app/routes/university#chong-qing-wen-li-xue-yuan',
|
||||
source: '/:type',
|
||||
target: (params) => {
|
||||
if (params.type === 'channel_7721.html') {
|
||||
if (params.type === 'channel_24894.html') {
|
||||
return '/cqwu/news/notify';
|
||||
}
|
||||
},
|
||||
|
|
@ -17,7 +17,7 @@ module.exports = {
|
|||
docs: 'https://docs.rsshub.app/routes/university#chong-qing-wen-li-xue-yuan',
|
||||
source: '/:type',
|
||||
target: (params) => {
|
||||
if (params.type === 'channel_7722.html') {
|
||||
if (params.type === 'channel_24895.html') {
|
||||
return '/cqwu/news/academiceve';
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue