diff --git a/lib/routes/caixin/latest.ts b/lib/routes/caixin/latest.ts index b6b23a9b27cb0e..da585b75c2e293 100644 --- a/lib/routes/caixin/latest.ts +++ b/lib/routes/caixin/latest.ts @@ -49,7 +49,12 @@ async function handler(ctx) { // desc const desc = await parseArticle(item); - item.description = ctx.req.query('fulltext') === 'true' ? ((await getFulltext(item.link)) ?? desc.description) : desc.description; + if (ctx.req.query('fulltext') === 'true') { + const authorizedFullText = await getFulltext(item.link); + item.description = authorizedFullText === '' ? desc.description : authorizedFullText; + } else { + item.description = desc.description; + } // prevent cache coliision with /caixin/article and /caixin/:column/:category // since those have podcasts item.guid = `caixin:latest:${item.link}`; diff --git a/lib/routes/caixin/utils-fulltext.ts b/lib/routes/caixin/utils-fulltext.ts index 1a8289049dda18..c866784508e529 100644 --- a/lib/routes/caixin/utils-fulltext.ts +++ b/lib/routes/caixin/utils-fulltext.ts @@ -46,6 +46,6 @@ export async function getFulltext(url: string) { }, }); - const { content } = JSON.parse(res.data.match(/resetContentInfo\((.*)\)/)[1]); - return content; + const { content = '', pictureList } = JSON.parse(res.data.match(/resetContentInfo\((.*)\)/)[1]); + return content + (pictureList ? pictureList.map((e) => `