From 4f0a740d02b060448a30177400a72a14cc64846c Mon Sep 17 00:00:00 2001
From: lidashuang
Date: Wed, 4 Dec 2024 20:04:23 +0800
Subject: [PATCH] feat(route): add amz123.com (#17799)
---
lib/routes/amz123/kx.ts | 65 ++++++++++++++++++++++++++++++++++
lib/routes/amz123/namespace.ts | 9 +++++
2 files changed, 74 insertions(+)
create mode 100644 lib/routes/amz123/kx.ts
create mode 100644 lib/routes/amz123/namespace.ts
diff --git a/lib/routes/amz123/kx.ts b/lib/routes/amz123/kx.ts
new file mode 100644
index 000000000..329b764b3
--- /dev/null
+++ b/lib/routes/amz123/kx.ts
@@ -0,0 +1,65 @@
+import { Route, ViewType } from '@/types';
+import got from '@/utils/got';
+import { parseDate } from '@/utils/parse-date';
+
+export const route: Route = {
+ path: '/kx',
+ categories: ['new-media'],
+ example: '/amz123/kx',
+ parameters: {},
+ features: {
+ requireConfig: false,
+ requirePuppeteer: false,
+ antiCrawler: false,
+ supportBT: false,
+ supportPodcast: false,
+ supportScihub: false,
+ },
+ radar: [
+ {
+ source: ['amz123.com/kx'],
+ target: '/kx',
+ },
+ ],
+ name: 'AMZ123 快讯',
+ maintainers: ['defp'],
+ handler,
+ url: 'amz123.com/kx',
+ view: ViewType.Articles,
+};
+
+async function handler() {
+ const limit = 12;
+ const apiRootUrl = 'https://api.amz123.com';
+ const rootUrl = 'https://www.amz123.com';
+
+ const { data: response } = await got.post(`${apiRootUrl}/ugc/v1/user_content/forum_list`, {
+ json: {
+ page: 1,
+ page_size: limit,
+ tag_id: 0,
+ fid: 4,
+ ban: 0,
+ is_new: 1,
+ },
+ headers: {
+ 'content-type': 'application/json',
+ },
+ });
+
+ const items = response.data.rows.map((item) => ({
+ title: item.title,
+ description: item.description,
+ pubDate: parseDate(item.published_at * 1000),
+ link: `${rootUrl}/kx/${item.id}`,
+ author: item.author?.username,
+ category: item.tags.map((tag) => tag.name),
+ guid: item.resource_id,
+ }));
+
+ return {
+ title: 'AMZ123 快讯',
+ link: `${rootUrl}/kx`,
+ item: items,
+ };
+}
diff --git a/lib/routes/amz123/namespace.ts b/lib/routes/amz123/namespace.ts
new file mode 100644
index 000000000..289242d2d
--- /dev/null
+++ b/lib/routes/amz123/namespace.ts
@@ -0,0 +1,9 @@
+import type { Namespace } from '@/types';
+
+export const namespace: Namespace = {
+ name: 'Amz123',
+ url: 'www.amz123.com',
+ categories: ['new-media'],
+ description: '跨境电商平台',
+ lang: 'zh-CN',
+};