feat(route): add 中国政法大学 (#18748)

* feat(route): 添加中国政法大学教务处通知公告路由

* fix(route): 修改中国政法大学教务处路由名称为“教务处通知公告”
This commit is contained in:
F.Rushmore.Coglan 2025-04-01 18:28:09 +08:00 committed by GitHub
parent 82e91a45d8
commit fd5cc6868f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 89 additions and 0 deletions

69
lib/routes/cupl/jwc.ts Normal file
View File

@ -0,0 +1,69 @@
import { Route } from '@/types';
import { load } from 'cheerio';
import { parseDate } from '@/utils/parse-date';
import ofetch from '@/utils/ofetch';
// import cache from '@/utils/cache';
export const route: Route = {
path: '/jwc',
url: 'jwc.cupl.edu.cn/index/tzgg.htm',
categories: ['university'],
example: '/cupl/jwc',
description: '中国政法大学教务处通知公告',
name: '教务处通知公告',
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false,
},
radar: [
{
source: ['jwc.cupl.edu.cn/index/tzgg.htm', 'jwc.cupl.edu.cn/'],
target: '/jwc',
},
],
maintainers: ['Fgju'],
handler: async (/* ctx*/) => {
const host = 'https://jwc.cupl.edu.cn/';
const response = await ofetch(host + 'index/tzgg.htm');
const $ = load(response);
const list = $('li[id^=line_u8_]')
.toArray()
.map((elem) => {
const elem_ = $(elem);
const a = elem_.find('a');
return {
link: a[1].attribs.href,
title: $(a[1]).text(),
pubDate: parseDate(elem_.find('span').text(), 'YYYY-MM-DD'),
category: $(a[0]).text().slice(0, -1),
description: '',
};
});
/*
const items = await Promise.all(
list.map((item) => {
cache.tryGet(item.link, async () => {
const response = await ofetch(host + item.link.slice(3));
const $ = load(response);
const content = $('.form[name=_newscontent_fromname]').html();
item.description = content ?? '';
return item;
}
)
})
);
*/
return {
title: '通知公告',
link: 'https://jwc.cupl.edu.cn/index/tzgg.htm',
description: '中国政法大学教务处通知公告',
language: 'zh-CN',
item: list,
};
},
};

View File

@ -0,0 +1,20 @@
import type { Namespace } from '@/types';
export const namespace: Namespace = {
name: 'CUPL',
url: 'jwc.cupl.edu.cn/index/tzgg.htm',
description: 'China University of Political Science and Law Academic Affairs Office Notices',
zh: {
name: '中国政法大学',
description: '中国政法大学教务处通知公告',
},
'zh-TW': {
name: '中國政法大學',
description: '中國政法大學教務處通知公告',
},
ja: {
name: '中国政法大学',
description: '中国政法大学教務処通知公告',
},
};