Files
RSSHub/lib/routes/hk01/latest.ts
T
Tony d585a87daf fix: allow multiple radar rules per route (#14800)
* fix: allow multiple radar rules per route

* fix: github folder

* feat: add namespace to radar target

* docs: fix types url
2024-03-16 03:28:44 +08:00

47 lines
1.1 KiB
TypeScript

import { Route } from '@/types';
import cache from '@/utils/cache';
import got from '@/utils/got';
import { rootUrl, apiRootUrl, ProcessItems } from './utils';
export const route: Route = {
path: '/latest',
categories: ['new-media'],
example: '/hk01/latest',
parameters: {},
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false,
},
radar: [
{
source: ['hk01.com/latest', 'hk01.com/'],
},
],
name: '即時',
maintainers: ['5upernova-heng'],
handler,
url: 'hk01.com/latest',
};
async function handler(ctx) {
const currentUrl = `${rootUrl}/latest`;
const apiUrl = `${apiRootUrl}/v2/page/latest`;
const response = await got({
method: 'get',
url: apiUrl,
});
const items = await ProcessItems(response.data.items, ctx.req.query('limit'), cache.tryGet);
return {
title: '即時 | 香港01',
link: currentUrl,
item: items,
};
}