/
today.ts
60 lines (55 loc) · 1.51 KB
/
today.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
59
60
import { Route } from '@/types';
import got from '@/utils/got';
import { parseDate } from '@/utils/parse-date';
export const route: Route = {
path: '/today',
categories: ['new-media'],
example: '/niaogebiji/today',
parameters: {},
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false,
},
radar: [
{
source: ['niaogebiji.com/', 'niaogebiji.com/bulletin'],
target: '',
},
],
name: '今日事',
maintainers: ['KotoriK'],
handler,
url: 'niaogebiji.com/',
};
async function handler() {
const response = await got({
method: 'post',
url: 'https://www.niaogebiji.com/pc/bulletin/index',
form: {
page: 1,
pub_time: '',
isfromajax: 1,
},
});
if (response.data.return_code !== '200') {
throw new Error(response.data.return_msg);
}
const data = response.data.return_data;
return {
title: '鸟哥笔记-今日事',
link: 'https://www.niaogebiji.com/bulletin',
item: data.map((item) => ({
title: item.title,
description: item.content,
link: item.url,
pubDate: parseDate(item.pub_time, 'X'),
updated: parseDate(item.updated_at, 'X'),
category: item.seo_keywords.split(','),
author: item.user_info.nickname,
})),
};
}