diff --git a/lib/routes/chinacdc/index.ts b/lib/routes/chinacdc/index.ts index 5ca8c021d7b947..da2f3acac15ad5 100644 --- a/lib/routes/chinacdc/index.ts +++ b/lib/routes/chinacdc/index.ts @@ -82,6 +82,7 @@ export const handler = async (ctx: Context): Promise => { return { title, description, + link: item.link, pubDate: parseDate($$('span.fb em').text()), content: { html: description, @@ -122,7 +123,7 @@ export const route: Route = { handler, example: '/chinacdc/zxyw', parameters: { - category: '分类,默认为 `zxyw`,即中心要闻,可在对应分类页 URL 中找到, Category, `zxyw`,即中心要闻 by default', + category: '分类,默认为 `zxyw`,即中心要闻,可在对应分类页 URL 中找到,Category, `zxyw`,即中心要闻 by default', }, description: `:::tip 若订阅 [中心要闻](https://www.chinacdc.cn/zxyw/),网址为 \`https://www.chinacdc.cn/zxyw/\`,请截取 \`https://www.chinacdc.cn/\` 到末尾 \`/\` 的部分 \`zxyw\` 作为 \`category\` 参数填入,此时目标路由为 [\`/chinacdc/zxyw\`](https://rsshub.app/chinacdc/zxyw)。 @@ -169,7 +170,7 @@ export const route: Route = { #### [全球公卫](https://www.chinacdc.cn/qqgw/) -| [合作伙伴](https://www.chinacdc.cn/qqgw/hzhb/) | [世界卫生组织合作中心和参比实验室](https://www.chinacdc.cn/qqgw/wszz/) | [国际交流(港澳台交流)](https://www.chinacdc.cn/qqgw/gjjl/) | [公共卫生援外与合作](https://www.chinacdc.cn/qqgw/ggws/) | +| [合作伙伴](https://www.chinacdc.cn/qqgw/hzhb/) | [世界卫生组织合作中心和参比实验室](https://www.chinacdc.cn/qqgw/wszz/) | [国际交流 (港澳台交流)](https://www.chinacdc.cn/qqgw/gjjl/) | [公共卫生援外与合作](https://www.chinacdc.cn/qqgw/ggws/) | | -------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------- | -------------------------------------------------------- | | [qqgw/hzhb](https://rsshub.app/chinacdc/qqgw/hzhb) | [qqgw/wszz](https://rsshub.app/chinacdc/qqgw/wszz) | [qqgw/gjjl](https://rsshub.app/chinacdc/qqgw/gjjl) | [qqgw/ggws](https://rsshub.app/chinacdc/qqgw/ggws) | @@ -371,7 +372,7 @@ export const route: Route = { target: '/qqgw/wszz', }, { - title: '全球公卫 - 国际交流(港澳台交流)', + title: '全球公卫 - 国际交流 (港澳台交流)', source: ['www.chinacdc.cn/qqgw/gjjl/'], target: '/qqgw/gjjl', }, diff --git a/lib/routes/msn/index.ts b/lib/routes/msn/index.ts index 93236eb490e812..5ca954bbeb7fcc 100644 --- a/lib/routes/msn/index.ts +++ b/lib/routes/msn/index.ts @@ -1,6 +1,7 @@ import { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +import cache from '@/utils/cache'; import { load } from 'cheerio'; const apiKey = '0QfOX3Vn51YCzitbLaRkTTBadtWpgTN8NZLW0C1SEM'; @@ -44,13 +45,34 @@ export const route: Route = { const requestMuid = parsedSettings.fd_muid; const jsonData = await ofetch(`https://assets.msn.com/service/news/feed/pages/providerfullpage?market=${market}&query=newest&CommunityProfileId=${truncatedId}&apikey=${apiKey}&user=m-${requestMuid}`); - const items = jsonData.sections[0].cards.map((card) => ({ - title: card.title, - link: card.url, - description: card.abstract, - pubDate: parseDate(card.publishedDateTime), - category: [card.category], - })); + const items = await Promise.all( + jsonData.sections[0].cards.map(async (card) => { + let articleContentHtml = ''; + + const articleUrl = card.url; + const parsedArticleUrl = URL.parse(articleUrl); + let articleId = parsedArticleUrl?.pathname.split('/').pop(); + if (articleId?.startsWith('ar-')) { + articleId = articleId.substring(3); + const fetchedArticleContentHtml = (await cache.tryGet(articleId, async () => { + const articleData = await ofetch(`https://assets.msn.com/content/view/v2/Detail/${market}/${articleId}`); + return articleData.body; + })) as string; // cache article content for 3 months + articleContentHtml = fetchedArticleContentHtml; + } + + return { + title: card.title, + link: articleUrl, + description: card.abstract, + content: { + html: articleContentHtml, + }, + pubDate: parseDate(card.publishedDateTime), + category: [card.category], + }; + }) + ); const channelLink = `https://www.msn.com/${market}/channel/source/${name}/${id}`; return { diff --git a/lib/routes/oschina/user.ts b/lib/routes/oschina/user.ts index 3c0198625cef75..c5069c72ef168c 100644 --- a/lib/routes/oschina/user.ts +++ b/lib/routes/oschina/user.ts @@ -69,7 +69,7 @@ async function handler(ctx) { return { title: author + '的博客', description: $('.user-text .user-signature').text(), - link: `https://my.oschina.net/${id ?? uid}`, + link: `https://my.oschina.net/u/${id ?? uid}`, item: resultItem, }; }