/
notice.ts
50 lines (45 loc) · 1.3 KB
/
notice.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import { Route } from '@/types';
import got from '@/utils/got';
import { load } from 'cheerio';
export const route: Route = {
path: '/scet/notice',
categories: ['university'],
example: '/scut/scet/notice',
parameters: {},
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false,
},
name: '土木与交通学院 - 学工通知',
maintainers: ['railzy'],
handler,
};
async function handler() {
const link = 'https://www2.scut.edu.cn/jtxs/24241/list.htm';
const response = await got({
method: 'get',
url: link,
});
const data = response.data;
const $ = load(data);
const list = $('#wp_news_w5 li');
return {
title: '华南理工大学土木与交通学院 - 学工通知',
link,
item:
list &&
list.toArray().map((item) => {
item = $(item);
return {
title: item.find('li a').text(),
description: item.find('li a').text(),
link: item.find('li a').attr('href'),
pubDate: item.find('.Article_PublishDate').text(),
};
}),
};
}