From f20428cde63ad41299a87682a4697288d4828c3c Mon Sep 17 00:00:00 2001 From: Tony Date: Sun, 20 Oct 2024 14:06:30 -0700 Subject: [PATCH] fix(route): customs (#17204) * fix(route): customs * docs: add back warning --- lib/routes/gov/customs/list.ts | 7 +++++-- lib/routes/gov/customs/namespace.ts | 7 +++++++ 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 lib/routes/gov/customs/namespace.ts diff --git a/lib/routes/gov/customs/list.ts b/lib/routes/gov/customs/list.ts index 599efd3b9..7aa23b615 100644 --- a/lib/routes/gov/customs/list.ts +++ b/lib/routes/gov/customs/list.ts @@ -31,8 +31,8 @@ export const route: Route = { handler, url: 'www.customs.gov.cn/', description: `:::warning - 由于区域限制,建议在国内 IP 的机器上自建 - :::`, +由于区域限制,建议在国内 IP 的机器上自建 +:::`, }; async function handler(ctx) { @@ -81,6 +81,9 @@ async function handler(ctx) { const out = await Promise.all( list.map((info) => cache.tryGet(info.link, async () => { + if (info.link.endsWith('.pdf') || info.link.endsWith('.doc')) { + return info; + } const response = await puppeteerGet(info.link, browser); const $ = load(response); let date; diff --git a/lib/routes/gov/customs/namespace.ts b/lib/routes/gov/customs/namespace.ts new file mode 100644 index 000000000..e67beeae3 --- /dev/null +++ b/lib/routes/gov/customs/namespace.ts @@ -0,0 +1,7 @@ +import type { Namespace } from '@/types'; + +export const namespace: Namespace = { + name: '中华人民共和国海关总署', + url: 'www.customs.gov.cn', + categories: ['government'], +};