From ae34cd01b08a20c6167afa3ef44ebd2d86b01876 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BD=98=E5=BA=86=E6=9D=B0?= <958843410@qq.com> Date: Wed, 27 May 2026 11:56:53 +0800 Subject: [PATCH 1/5] =?UTF-8?q?add:=20aiera.com.cn=20=E6=96=B0=E6=99=BA?= =?UTF-8?q?=E5=85=83=20RSS=20=E8=B7=AF=E7=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/routes/aiera/latest.ts | 53 +++++++++++++++++++++++++++++++++++ lib/routes/aiera/namespace.ts | 8 ++++++ 2 files changed, 61 insertions(+) create mode 100644 lib/routes/aiera/latest.ts create mode 100644 lib/routes/aiera/namespace.ts diff --git a/lib/routes/aiera/latest.ts b/lib/routes/aiera/latest.ts new file mode 100644 index 000000000000..368839eee29d --- /dev/null +++ b/lib/routes/aiera/latest.ts @@ -0,0 +1,53 @@ +import type { Route } from '@/types'; +import got from '@/utils/got'; +import { parseDate } from '@/utils/parse-date'; + +export const route: Route = { + path: '/latest', + categories: ['new-media'], + example: '/aiera/latest', + parameters: {}, + features: { + requireConfig: false, + requirePuppeteer: false, + antiCrawler: false, + supportBT: false, + supportPodcast: false, + supportScihub: false, + }, + radar: [ + { + source: ['aiera.com.cn'], + target: '/latest', + }, + ], + name: '最新文章', + maintainers: ['panqingjie00'], + handler, +}; + +async function handler() { + const response = await got(`https://aiera.com.cn/wp-json/wp/v2/posts`, { + searchParams: { + per_page: 20, + _embed: '', + }, + }); + + const items = response.data.map((item) => ({ + title: item.title.rendered, + description: item.content.rendered, + pubDate: parseDate(item.date_gmt), + link: item.link, + guid: item.guid.rendered, + author: item._embedded?.author?.[0]?.name, + })); + + return { + title: '新智元 - 最新文章', + link: 'https://aiera.com.cn', + description: '新智元最新 AI 新闻资讯', + language: 'zh-CN', + item: items, + }; +} diff --git a/lib/routes/aiera/namespace.ts b/lib/routes/aiera/namespace.ts new file mode 100644 index 000000000000..643f15c0f86b --- /dev/null +++ b/lib/routes/aiera/namespace.ts @@ -0,0 +1,8 @@ +import type { Namespace } from '@/types'; + +export const namespace: Namespace = { + name: '新智元', + url: 'aiera.com.cn', + lang: 'zh-CN', + description: '新智元 - AI 新闻资讯平台', +}; From 5bcb15dcd3c5baecc352950b4c9e8338d592a58f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BD=98=E5=BA=86=E6=9D=B0?= <958843410@qq.com> Date: Wed, 27 May 2026 12:16:53 +0800 Subject: [PATCH 2/5] =?UTF-8?q?add:=20aiera.com.cn=20=E6=96=B0=E6=99=BA?= =?UTF-8?q?=E5=85=83=E6=9C=80=E6=96=B0=E6=96=87=E7=AB=A0=20RSS=20=E8=B7=AF?= =?UTF-8?q?=E7=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/routes/aiera/latest.ts | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/lib/routes/aiera/latest.ts b/lib/routes/aiera/latest.ts index 368839eee29d..854a633d4a06 100644 --- a/lib/routes/aiera/latest.ts +++ b/lib/routes/aiera/latest.ts @@ -6,7 +6,9 @@ export const route: Route = { path: '/latest', categories: ['new-media'], example: '/aiera/latest', - parameters: {}, + url: 'aiera.com.cn', + name: '最新文章', + maintainers: ['panqingjie00'], features: { requireConfig: false, requirePuppeteer: false, @@ -21,20 +23,25 @@ export const route: Route = { target: '/latest', }, ], - name: '最新文章', - maintainers: ['panqingjie00'], handler, }; -async function handler() { - const response = await got(`https://aiera.com.cn/wp-json/wp/v2/posts`, { - searchParams: { - per_page: 20, - _embed: '', - }, +async function handler(ctx) { + const response = await ctx.cache.tryGet('aiera:latest', async () => { + const { data } = await got('https://aiera.com.cn/wp-json/wp/v2/posts', { + searchParams: { + per_page: 20, + _embed: '', + }, + }); + return data; }); - const items = response.data.map((item) => ({ + if (!Array.isArray(response)) { + throw new Error('Invalid API response'); + } + + const items = response.map((item) => ({ title: item.title.rendered, description: item.content.rendered, pubDate: parseDate(item.date_gmt), From ad40f542ef759f6a35ceed42752cd8c7c873ca44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BD=98=E5=BA=86=E6=9D=B0?= <958843410@qq.com> Date: Wed, 27 May 2026 13:25:45 +0800 Subject: [PATCH 3/5] fix: use cache from @/utils/cache instead of ctx.cache --- lib/routes/aiera/latest.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/routes/aiera/latest.ts b/lib/routes/aiera/latest.ts index 854a633d4a06..0d6484282338 100644 --- a/lib/routes/aiera/latest.ts +++ b/lib/routes/aiera/latest.ts @@ -1,4 +1,5 @@ import type { Route } from '@/types'; +import cache from '@/utils/cache'; import got from '@/utils/got'; import { parseDate } from '@/utils/parse-date'; @@ -27,7 +28,7 @@ export const route: Route = { }; async function handler(ctx) { - const response = await ctx.cache.tryGet('aiera:latest', async () => { + const response = await cache.tryGet('aiera:latest', async () => { const { data } = await got('https://aiera.com.cn/wp-json/wp/v2/posts', { searchParams: { per_page: 20, From fde16c375738b128c7c4db9e330b9d97f26765d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BD=98=E5=BA=86=E6=9D=B0?= <958843410@qq.com> Date: Wed, 27 May 2026 13:43:07 +0800 Subject: [PATCH 4/5] fix: resolve oxlint errors, remove unused ctx parameter --- lib/routes/aiera/latest.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/routes/aiera/latest.ts b/lib/routes/aiera/latest.ts index 0d6484282338..d4d5d034a9d8 100644 --- a/lib/routes/aiera/latest.ts +++ b/lib/routes/aiera/latest.ts @@ -27,7 +27,7 @@ export const route: Route = { handler, }; -async function handler(ctx) { +async function handler() { const response = await cache.tryGet('aiera:latest', async () => { const { data } = await got('https://aiera.com.cn/wp-json/wp/v2/posts', { searchParams: { @@ -39,7 +39,7 @@ async function handler(ctx) { }); if (!Array.isArray(response)) { - throw new Error('Invalid API response'); + throw new TypeError('Invalid API response'); } const items = response.map((item) => ({ From 14d218a2e37eeea8b97b53104e7092552a10a849 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BD=98=E5=BA=86=E6=9D=B0?= <958843410@qq.com> Date: Wed, 27 May 2026 14:56:15 +0800 Subject: [PATCH 5/5] fix: add feed image (site icon) to aiera route --- lib/routes/aiera/latest.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/routes/aiera/latest.ts b/lib/routes/aiera/latest.ts index d4d5d034a9d8..8fa6a64f4ad9 100644 --- a/lib/routes/aiera/latest.ts +++ b/lib/routes/aiera/latest.ts @@ -56,6 +56,7 @@ async function handler() { link: 'https://aiera.com.cn', description: '新智元最新 AI 新闻资讯', language: 'zh-CN', + image: 'https://aiera.com.cn/wp-content/uploads/2025/01/%E6%96%B0%E6%99%BA%E5%85%83%E7%BD%91%E7%AB%99logo-150x150.png', item: items, }; }