From 456119779f004a2cc0820791008546bf7604f4bf Mon Sep 17 00:00:00 2001 From: pseudoyu Date: Wed, 1 Jan 2025 01:11:48 +0800 Subject: [PATCH] feat(chinacdc): empty title --- lib/routes/chinacdc/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/routes/chinacdc/index.ts b/lib/routes/chinacdc/index.ts index da2f3acac15ad5..f3c0222a2d665c 100644 --- a/lib/routes/chinacdc/index.ts +++ b/lib/routes/chinacdc/index.ts @@ -32,7 +32,7 @@ export const handler = async (ctx: Context): Promise => { const aEl: Cheerio = $item.find('a'); - const title: string = aEl.prop('title') || aEl.text(); + const title: string = aEl.prop('title') === undefined ? aEl.text() : aEl.prop('title'); const description: string = art(path.join(__dirname, 'templates/description.art'), { intro: $item.find('p.zy').text(), @@ -74,13 +74,13 @@ export const handler = async (ctx: Context): Promise => { const detailResponse = await ofetch(item.link); const $$: CheerioAPI = load(detailResponse); - const title: string = $$('h5').text(); + const detailTitle: string = $$('h5').text(); const description: string = art(path.join(__dirname, 'templates/description.art'), { description: $$('div.TRS_Editor').html(), }); return { - title, + title: detailTitle || item.title, // Use original title as fallback description, link: item.link, pubDate: parseDate($$('span.fb em').text()),