From 24c5045556d300b8f711786d5cfd131ab4bf4205 Mon Sep 17 00:00:00 2001 From: Andvari <31068367+dzx-dzx@users.noreply.github.com> Date: Tue, 1 Oct 2024 15:17:51 +0800 Subject: [PATCH] fix(route/rss): Manually set RSS version when parsing (#16973) --- lib/routes/nikkei/cn/index.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/routes/nikkei/cn/index.ts b/lib/routes/nikkei/cn/index.ts index 31309bb0cf45f8..50a96f572d1a8a 100644 --- a/lib/routes/nikkei/cn/index.ts +++ b/lib/routes/nikkei/cn/index.ts @@ -5,7 +5,18 @@ import got from '@/utils/got'; import { load } from 'cheerio'; import timezone from '@/utils/timezone'; import { parseDate } from '@/utils/parse-date'; -import parser from '@/utils/rss-parser'; +import { config } from '@/config'; +import Parser from 'rss-parser'; + +const parser = new Parser({ + customFields: { + item: ['magnet'], + }, + headers: { + 'User-Agent': config.ua, + }, + defaultRSS: 0.9, +}); export const route: Route = { path: '/cn/*',