Files
RSSHub/lib/routes/gov/cmse/fxrw.ts
T
DIYgod 83e701b592 feat: compile ts through tsdown (#18908)
* feat: build ts via tsdown

* feat: exec tsdown

* fix

* fix

* fix

* feat: use tsdown shims

* chore: run rolldown lifecycle script

* fix: use shims

---------
2025-04-22 22:29:11 +08:00

67 lines
1.8 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { Route } from '@/types';
import got from '@/utils/got';
import { load } from 'cheerio';
import timezone from '@/utils/timezone';
import { parseDate } from '@/utils/parse-date';
import { art } from '@/utils/render';
import path from 'node:path';
export const route: Route = {
path: '/cmse/fxrw',
categories: ['government'],
example: '/gov/cmse/fxrw',
parameters: {},
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false,
},
radar: [
{
source: ['www.cmse.gov.cn/fxrw'],
},
],
name: '飞行任务',
maintainers: ['nczitzk'],
handler,
url: 'www.cmse.gov.cn/fxrw',
};
async function handler() {
const rootUrl = 'http://www.cmse.gov.cn';
const currentUrl = `${rootUrl}/fxrw/`;
const response = await got({
method: 'get',
url: currentUrl,
});
const $ = load(response.data);
const items = $('#list li a')
.toArray()
.map((item) => {
item = $(item);
return {
title: item.find('.title').text().split(':').pop().trim(),
link: new URL(item.attr('href'), currentUrl).href,
pubDate: timezone(parseDate(item.find('.infoR').first().text().trim(), 'YYYY年M月D日H时m分'), +8),
description: art(path.join(__dirname, 'templates/description.art'), {
image: new URL(item.find('img').attr('src'), currentUrl).href,
description: item.find('.info').html(),
}),
};
});
return {
title: $('title').text(),
link: currentUrl,
item: items,
};
}