From cfd2477e37322dee0c21080d9041a710d882eec9 Mon Sep 17 00:00:00 2001 From: cnkmmk <22782790+cnkmmk@users.noreply.github.com> Date: Fri, 22 Mar 2024 14:26:27 +0800 Subject: [PATCH] =?UTF-8?q?feat(route):=20add=20=E5=AD=90=E6=96=B9?= =?UTF-8?q?=E6=9C=89=E6=96=99=20(#14905)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/routes/ippa/namespace.ts | 6 ++++++ lib/routes/ippa/rss.ts | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 lib/routes/ippa/namespace.ts create mode 100644 lib/routes/ippa/rss.ts diff --git a/lib/routes/ippa/namespace.ts b/lib/routes/ippa/namespace.ts new file mode 100644 index 0000000000..7c7ed93f74 --- /dev/null +++ b/lib/routes/ippa/namespace.ts @@ -0,0 +1,6 @@ +import type { Namespace } from '@/types'; + +export const namespace: Namespace = { + name: '子方有料', + url: 'ippa.top', +}; diff --git a/lib/routes/ippa/rss.ts b/lib/routes/ippa/rss.ts new file mode 100644 index 0000000000..db65ffaf5c --- /dev/null +++ b/lib/routes/ippa/rss.ts @@ -0,0 +1,35 @@ +import { Route } from '@/types'; +import { parseDate } from '@/utils/parse-date'; +import got from '@/utils/got'; + +export const route: Route = { + path: '/', + categories: ['blog'], + example: '/ippa', + radar: [ + { + source: ['ippa.top/'], + }, + ], + name: '最新文章', + maintainers: ['cnkmmk'], + handler, + url: 'ippa.top/', +}; + +async function handler() { + const url = 'https://www.ippa.top'; + const response = await got(`${url}/wp-json/wp/v2/posts`); + const list = response.data; + return { + title: '子方有料', + link: url, + description: '子方有料 - 最新文章', + item: list.map((item) => ({ + title: item.title.rendered, + link: item.link, + pubDate: parseDate(item.date_gmt), + description: item.content.rendered, + })), + }; +}