From 1f619e46e150e24c5c2ca8fd397050c85084a218 Mon Sep 17 00:00:00 2001 From: Tony Date: Fri, 31 May 2024 14:41:03 +0800 Subject: [PATCH] fix(route): fetch articles from osc.cool (#15776) --- lib/routes/oschina/news.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/routes/oschina/news.ts b/lib/routes/oschina/news.ts index 06b702771..7de987fa1 100644 --- a/lib/routes/oschina/news.ts +++ b/lib/routes/oschina/news.ts @@ -4,6 +4,7 @@ import got from '@/utils/got'; import { parseDate, parseRelativeDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; import { load } from 'cheerio'; +import { fetchArticle } from '@/utils/wechat-mp'; const configs = { all: { @@ -111,8 +112,7 @@ async function handler(ctx) { item.description = content('.article-detail').html(); item.author = content('.article-box__meta .item').first().text(); - } - if (/^https?:\/\/gitee.com\/.*$/.test(item.link)) { + } else if (/^https?:\/\/gitee\.com\/.*$/.test(item.link)) { const detail = await got(item.link, { headers: { Referer: config.link, @@ -121,6 +121,8 @@ async function handler(ctx) { const content = load(detail.data); item.description = content('.file_content').html(); + } else if (/^https?:\/\/osc\.cool\/.*$/.test(item.link)) { + return fetchArticle(item.link, true); } return item; })