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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user