Files
RSSHub/lib/routes/anquanke/vul.ts
T
Tony a5e2e295dc refactor: fix all get to toArray (#19000)
* refactor: fix all get

* fix(utils/common-config): charset case compare

* Revert "fix(utils/common-config): charset case compare"

This reverts commit 3c1880f2fad53ad2cafddcee7741390fd46fa3d2.

* fix: nga

* fix: notateslaapp

* fix: ps

* fix: xjtu

* fix: enforce error on restricted syntax for get calls

* fix: eslint

* fix: more eslint
2025-05-04 05:24:53 +08:00

37 lines
1.1 KiB
TypeScript

import got from '@/utils/got';
import { load } from 'cheerio';
import { parseDate } from '@/utils/parse-date';
const handler = async () => {
const url = 'https://www.anquanke.com';
const response = await got(`${url}/vul`);
const $ = load(response.data);
const list = $('table>tbody>tr').toArray();
const items = list.map((i) => {
const item = $(i);
const title = item.find('td:first-child a').text();
const cve = item.find('td:nth-child(2)').text();
const pla = item.find('.vul-type-item').text().replaceAll(/\s+/g, '');
const date = parseDate(item.find('td:nth-last-child(2)').text().replaceAll(/\s+/g, ''));
const href = item.find('a').attr('href');
return {
title: `${title}【${cve}】${pla === '未知' ? '' : pla}`,
description: `编号:${cve} | 平台:${pla}`,
pubDate: date,
link: `${url}${href}`,
};
});
return {
title: '安全客-漏洞cve报告',
link: 'https://www.anquanke.com/vul',
item: items,
};
};
export default handler;