diff --git a/lib/routes/kurogames/wutheringwaves/constants.ts b/lib/routes/kurogames/wutheringwaves/constants.ts index 9d0ae687c..63efc6502 100644 --- a/lib/routes/kurogames/wutheringwaves/constants.ts +++ b/lib/routes/kurogames/wutheringwaves/constants.ts @@ -21,7 +21,7 @@ export enum Parameter { export const SUPPORTED_LANGUAGES = Object.values(Language); export interface Article { - articleContent: string; + articleContent?: string; articleDesc: string; articleId: number; articleTitle: string; diff --git a/lib/routes/kurogames/wutheringwaves/news.ts b/lib/routes/kurogames/wutheringwaves/news.ts index fff5216d6..0a734a6d7 100644 --- a/lib/routes/kurogames/wutheringwaves/news.ts +++ b/lib/routes/kurogames/wutheringwaves/news.ts @@ -63,7 +63,10 @@ Language codes for the \`${Parameter.Language}\` parameter: }; return cache.tryGet(`wutheringwaves:${language}:${article.articleId}`, async () => { - const { articleContent } = await ofetch
(contentUrl, { query: { t: Date.now() } }); + const articleDetails = await ofetch
(contentUrl, { query: { t: Date.now() } }); + // Article content may not always be available, e.g: https://wutheringwaves.kurogames.com/zh-tw/main/news/detail/2596 + const articleContent = articleDetails.articleContent ?? ''; + const $ = cheerio.load(articleContent); item.description = $.html() ?? article.articleDesc ?? '';