From c209a7c4198882caa087feeb1e36cbe182a63d3c Mon Sep 17 00:00:00 2001 From: cnkmmk <22782790+cnkmmk@users.noreply.github.com> Date: Sun, 17 Mar 2024 01:23:11 +0800 Subject: [PATCH] =?UTF-8?q?feat(route):=20add=20=E4=BE=BF=E5=AE=9CVPS?= =?UTF-8?q?=E7=BD=91=20(#14740)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add 便宜VPS网 * Update rss.ts --------- Co-authored-by: pull[bot] <39814207+pull[bot]@users.noreply.github.com> --- lib/routes/pianyivps/namespace.ts | 6 ++++++ lib/routes/pianyivps/rss.ts | 32 +++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 lib/routes/pianyivps/namespace.ts create mode 100644 lib/routes/pianyivps/rss.ts diff --git a/lib/routes/pianyivps/namespace.ts b/lib/routes/pianyivps/namespace.ts new file mode 100644 index 000000000..5145b28a2 --- /dev/null +++ b/lib/routes/pianyivps/namespace.ts @@ -0,0 +1,6 @@ +import type { Namespace } from '@/types'; + +export const namespace: Namespace = { + name: '便宜VPS网', + url: 'pianyivps.com', +}; diff --git a/lib/routes/pianyivps/rss.ts b/lib/routes/pianyivps/rss.ts new file mode 100644 index 000000000..3453a8582 --- /dev/null +++ b/lib/routes/pianyivps/rss.ts @@ -0,0 +1,32 @@ +import { Route } from '@/types'; +import { parseDate } from '@/utils/parse-date'; +import got from '@/utils/got'; + +export const route: Route = { + path: '/', + categories: ['blog'], + radar: [{ + source: ['pianyivps.com/'], + }], + name: '最新发布', + maintainers: ['cnkmmk'], + handler, + url: 'pianyivps.com/', +}; + +async function handler() { + const url = 'https://www.pianyivps.com'; + const response = await got(`${url}/wp-json/wp/v2/posts`); + const list = response.data; + return { + title: '便宜VPS网', + link: url, + description: '便宜VPS网 - 最新发布', + item: list.map((item) => ({ + title: item.title.rendered, + link: item.link, + pubDate: parseDate(item.date_gmt), + description: item.content.rendered, + })), + }; +}