From 55fadd3997d35c50c5debba0b03179954ea9f1c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E9=98=B3?= <1002522146@qq.com> Date: Fri, 14 Mar 2025 11:28:31 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat(route):=20add=20=E8=8D=A3=E9=BC=8E?= =?UTF-8?q?=E5=92=A8=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/routes/rhg/blog.ts | 52 +++++++++++++++++++++++++++++++++++++ lib/routes/rhg/namespace.ts | 7 +++++ 2 files changed, 59 insertions(+) create mode 100644 lib/routes/rhg/blog.ts create mode 100644 lib/routes/rhg/namespace.ts diff --git a/lib/routes/rhg/blog.ts b/lib/routes/rhg/blog.ts new file mode 100644 index 00000000000000..da732eb8a445ef --- /dev/null +++ b/lib/routes/rhg/blog.ts @@ -0,0 +1,52 @@ +import { Route, ViewType } from '@/types'; +import ofetch from '@/utils/ofetch'; +import { load } from 'cheerio'; + +export const route: Route = { + path: '/blog', + categories: ['new-media'], + view: ViewType.Articles, + example: '/rhg/blog', + url: 'rhg.com', + name: 'Articles', + maintainers: ['xnum'], + radar: [ + { + title: 'China', + source: ['rhg.com/'], + }, + ], + features: { + requireConfig: false, + requirePuppeteer: false, + antiCrawler: false, + supportBT: false, + supportPodcast: false, + supportScihub: false, + }, + handler, +}; + +const rootUrl = 'https://rhg.com/china/research'; +async function handler() { + const response = await ofetch(`https://rhg.com/china/research`); + const $ = load(response); + const items = $('.c-listing__list .c-card') + .toArray() + .map((item) => { + const $item = $(item); + const title = $item.find('.c-card__title').text(); + const link = $item.find('.c-card__link').attr('href'); + const description = $item.find('.c-card__description').text(); + return { + title, + link, + description, + }; + }); + return { + title: '荣鼎咨询-China', + link: rootUrl, + item: items, + }; +} diff --git a/lib/routes/rhg/namespace.ts b/lib/routes/rhg/namespace.ts new file mode 100644 index 00000000000000..a71ade5ceffbc1 --- /dev/null +++ b/lib/routes/rhg/namespace.ts @@ -0,0 +1,7 @@ +import type { Namespace } from '@/types'; + +export const namespace: Namespace = { + name: '荣鼎咨询', + url: 'rhg.com', + description: '荣鼎咨询研究报告', +}; From 52fff8552fdea7edc9a39874bdb78c8cfc0612e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E9=98=B3?= <1002522146@qq.com> Date: Fri, 14 Mar 2025 14:40:21 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat:=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/routes/rhg/blog.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/routes/rhg/blog.ts b/lib/routes/rhg/blog.ts index da732eb8a445ef..656aadfc1434c1 100644 --- a/lib/routes/rhg/blog.ts +++ b/lib/routes/rhg/blog.ts @@ -27,9 +27,9 @@ export const route: Route = { handler, }; -const rootUrl = 'https://rhg.com/china/research'; async function handler() { - const response = await ofetch(`https://rhg.com/china/research`); + const rootUrl = 'https://rhg.com/china/research'; + const response = await ofetch(rootUrl); const $ = load(response); const items = $('.c-listing__list .c-card') .toArray()