/
yz.ts
58 lines (53 loc) 路 1.45 KB
/
yz.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
51
52
53
54
55
56
57
58
import { Route } from '@/types';
import got from '@/utils/got';
import { load } from 'cheerio';
import { parseDate } from '@/utils/parse-date';
/* 鐮旂┒鐢熸嫑鐢熺綉閫氱煡鍏憡*/
export const route: Route = {
path: '/yz',
categories: ['university'],
example: '/cuc/yz',
parameters: {},
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false,
},
radar: [
{
source: ['yz.cuc.edu.cn/8549/list.htm', 'yz.cuc.edu.cn/'],
},
],
name: '鐮旂┒鐢熸嫑鐢熺綉',
maintainers: ['niuyi1017'],
handler,
url: 'yz.cuc.edu.cn/8549/list.htm',
};
async function handler() {
const host = 'https://yz.cuc.edu.cn';
const link = `${host}/8549/list.htm`;
const response = await got({
method: 'get',
url: link,
});
const $ = load(response.data);
const content = $('.news_list li');
const items = content.toArray().map((elem) => {
elem = $(elem);
const a = elem.find('a');
return {
link: new URL(a.attr('href'), host).href,
title: a.attr('title'),
pubDate: parseDate(elem.find('.news_meta').text(), 'YYYY-MM-DD'),
};
});
return {
title: $('title').text(),
link,
description: '涓浗浼犲獟澶у鐮旂┒鐢熸嫑鐢熺綉 閫氱煡鍏憡',
item: items,
};
}