From b5bcb8a5677b0491248e1f8dc732552d0198b8d0 Mon Sep 17 00:00:00 2001 From: Chih-Hsuan Yen <1937689+yan12125@users.noreply.github.com> Date: Sat, 23 May 2026 13:21:45 +0800 Subject: [PATCH] feat(route/cna): cleanup extracted full texts (#21962) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Here is a page with description-box: https://www.cna.com.tw/news/aipl/202605070117.aspx Explanation for the term 憲法第130條 is injected in the middle of a paragraph and makes that paragraph hard to read. This change fixes that. --- lib/routes/cna/utils.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/routes/cna/utils.ts b/lib/routes/cna/utils.ts index 57f341871..9096ad60a 100644 --- a/lib/routes/cna/utils.ts +++ b/lib/routes/cna/utils.ts @@ -14,6 +14,13 @@ export async function getFullText(item) { const content = load(detailResponse.data); content('div.SubscriptionInner').remove(); content('.gmailNews').remove(); + + // Those boxes are for explaining terms. They are injected inline and interrupt reading. + // If readers want to learn about terms, they can learn more online. + content('.dictionary-box').remove(); + // Those are for "延伸閱讀" links, which are not part of the main article. + content('.moreArticle').remove(); + const topImage = content('.fullPic').html(); item.description = (topImage === null ? '' : topImage) + content('.paragraph').eq(0).html();