From 816d29de46ddad4f389033b84ebdc5228364f1f9 Mon Sep 17 00:00:00 2001 From: Rongrong Date: Mon, 15 May 2023 03:16:43 +0800 Subject: [PATCH] fix(route/wechat/feeddd): obsolete domain (#12510) * fix(route/wechat/feeddd): obsolete domain Signed-off-by: Rongrong * Update lib/v2/wechat/radar.js --------- Signed-off-by: Rongrong --- docs/new-media.md | 11 ++++++++++- lib/v2/wechat/feeddd.js | 15 ++++++++++++--- lib/v2/wechat/radar.js | 4 ++-- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/docs/new-media.md b/docs/new-media.md index a2891688d..5cf3e9f33 100644 --- a/docs/new-media.md +++ b/docs/new-media.md @@ -4086,7 +4086,16 @@ column 为 third 时可选的 category: ### 公众号(feeddd 来源) - +::: warning 注意 + +feeddd 网站不提供检索功能,请自行在 中检索所需公众号。\ +也可以在 上找到最近更新的公众号。请注意公众号页 id 与订阅时实际使用的 id 不同,请先复制订阅链接,再从中获取 id。 + +feeddd 自 2023/05/04 已更换域名,原 `feeddd.org` 已失效,现在使用 `feed.hamibot.com`。请及时更新自建实例。 + +::: + + ### 公众号(自由微信来源) diff --git a/lib/v2/wechat/feeddd.js b/lib/v2/wechat/feeddd.js index 009b8b43b..afc713702 100644 --- a/lib/v2/wechat/feeddd.js +++ b/lib/v2/wechat/feeddd.js @@ -5,10 +5,19 @@ const { finishArticleItem } = require('@/utils/wechat-mp'); module.exports = async (ctx) => { const id = ctx.params.id; - const baseUrl = 'https://api.feeddd.org'; - const apiUrl = `${baseUrl}/feeds/${id}/json`; + const baseUrl = 'https://feed.hamibot.com'; + const apiUrl = `${baseUrl}/api/feeds/${id}/json`; - const response = await got(apiUrl); + let response; + + try { + response = await got(apiUrl); + } catch (error) { + if (error.name === 'HTTPError' && error.response.statusCode === 404) { + throw Error('该公众号不存在,有关如何获取公众号 id,详见 https://docs.rsshub.app/new-media.html#wei-xin-gong-zhong-hao-feeddd-lai-yuan'); + } + throw error; + } let items = response.data.items.map((item) => ({ title: item.title, diff --git a/lib/v2/wechat/radar.js b/lib/v2/wechat/radar.js index dc7bb6650..dea1b4a51 100644 --- a/lib/v2/wechat/radar.js +++ b/lib/v2/wechat/radar.js @@ -32,9 +32,9 @@ module.exports = { }, ], }, - 'feeddd.org': { + 'hamibot.com': { _name: '微信', - '.': [ + feed: [ { title: '公众号(feeddd 来源)', docs: 'https://docs.rsshub.app/new-media.html#wei-xin',