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, + })), + }; +}