/
all.ts
78 lines (71 loc) 路 2.31 KB
/
all.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import { Route } from '@/types';
import { getCurrentPath } from '@/utils/helpers';
const __dirname = getCurrentPath(import.meta.url);
import got from '@/utils/got';
import { load } from 'cheerio';
import path from 'node:path';
import { art } from '@/utils/render';
import timezone from '@/utils/timezone';
import { parseDate } from '@/utils/parse-date';
import md5 from '@/utils/md5';
export const route: Route = {
path: '/quotation/all',
categories: ['other'],
example: '/cebbank/quotation/all',
parameters: {},
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false,
},
radar: [
{
source: ['cebbank.com/site/ygzx/whpj/index.html', 'cebbank.com/eportal/ui', 'cebbank.com/'],
},
],
name: 'Unknown',
maintainers: ['linbuxiao'],
handler,
url: 'cebbank.com/site/ygzx/whpj/index.html',
};
async function handler(ctx) {
const link = 'https://www.cebbank.com/eportal/ui?pageId=477257';
const content = await got({
method: 'get',
url: link,
});
const $ = load(content.data);
const items = $('.lczj_box tbody tr')
.map((i, e) => {
if (i < 2) {
return null;
}
const c = load(e, { decodeEntities: false });
return {
title: c('td:nth-child(1)').text(),
description: art(path.join(__dirname, 'templates/allDes.art'), {
fcer: c('td:nth-child(2)').text(),
pmc: c('td:nth-child(3)').text(),
exrt: c('td:nth-child(4)').text(),
mc: c('td:nth-child(5)').text(),
}),
pubDate: timezone(parseDate($('#t_id span').text().substring(5), 'YYYY-MM-DD HH:mm', true), 8),
guid: md5(c('td:nth-child(1)').text() + $('#t_id span').text().substring(5)),
};
})
.get();
const ret = {
title: '涓浗鍏夊ぇ閾惰',
description: '涓浗鍏夊ぇ閾惰 澶栨眹鐗屼环',
link,
item: items,
};
ctx.set('json', {
...ret,
pubDate: timezone(parseDate($('#t_id span').text().substring(5), 'YYYY-MM-DD HH:mm', true), 0),
});
return ret;
}