feat(route): add 中国政法大学 (#18748)
* feat(route): 添加中国政法大学教务处通知公告路由 * fix(route): 修改中国政法大学教务处路由名称为“教务处通知公告”
This commit is contained in:
parent
82e91a45d8
commit
fd5cc6868f
|
|
@ -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,
|
||||
};
|
||||
},
|
||||
};
|
||||
|
|
@ -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: '中国政法大学教務処通知公告',
|
||||
},
|
||||
};
|
||||
Loading…
Reference in New Issue