feat(route/cna): cleanup extracted full texts (#21962)

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.
This commit is contained in:
Chih-Hsuan Yen
2026-05-23 05:21:45 +00:00
committed by GitHub
parent 10f6939c91
commit b5bcb8a567
+7
View File
@@ -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();