diff --git a/lib/routes/cdu/jwgg.ts b/lib/routes/cdu/jwgg.ts new file mode 100644 index 00000000000000..a850236da994f9 --- /dev/null +++ b/lib/routes/cdu/jwgg.ts @@ -0,0 +1,79 @@ +import { Route } from '@/types'; +import cache from '@/utils/cache'; +import got from '@/utils/got'; +import { load } from 'cheerio'; +import { parseDate } from '@/utils/parse-date'; +import timezone from '@/utils/timezone'; + +export const route: Route = { + path: '/jwgg', + categories: ['university'], + example: '/cdu/jwgg', + parameters: {}, + features: { + requireConfig: false, + requirePuppeteer: false, + antiCrawler: false, + supportBT: false, + supportPodcast: false, + supportScihub: false, + }, + radar: [ + { + source: ['jw.cdu.edu.cn/'], + }, + ], + name: '教务处通知公告', + maintainers: ['uuwor'], + handler, + url: 'jw.cdu.edu.cn/', +}; + +async function handler() { + const url = 'https://jw.cdu.edu.cn/jwgg.htm';// 数据来源网页(待提取网页) + const response = await got.get(url); + const data = response.data; + const $ = load(data); + const list = $('.ListTable.dataTable.no-footer tbody tr[role="row"].odd') + .slice(0, 10) + .toArray() + .map((e) => { + const element = $(e); + const title = element.find('tr.odd a').text().trim();/* 1.选择器 tr.odd a:这个选择器查找具有 class="odd" 的