refactor: remove unnecessary trim/first/last (#22837)

* refactor: remove unnecessary trim/first/last

* refactor(types): allow null in DataItem.description

* refactor: remove unnecessary fallback

* refactor(types): allow null in Data.description

* refactor: remove unnecessary fallback

* refactor: remove .clone()

* refactor: refine json content text

* fIx: cognition

* fix: more fixes

* fix(route/jiemian): use api

* fix(route/jandan): housekeeping

add back maintainers from #8904

* fix(route/kcna/news): update source and target mappings

* fix(route/jandan): sanitize HTML content in titles

* refactor: remove unnecessary referer

* fix(route/jinse): regex
This commit is contained in:
Tony
2026-07-27 22:23:57 +08:00
committed by GitHub
parent 14e552cab6
commit 5527d18de9
486 changed files with 1483 additions and 2334 deletions
+2 -8
View File
@@ -30,15 +30,9 @@ async function processItem({ link: articleLink, date }) {
.map((tag) => $(tag).find('a').text());
const article = $('main > article');
const title = article.find('h1').text();
article.find('img').each((_, element) => {
const img = $(element);
const src = img.attr('src');
if (src?.startsWith('/')) {
img.attr('src', `${rootUrl}${src}`);
}
});
const image = article.find('img').attr('src');
const description = article.clone().find('h1, script').remove().end().html();
article.find('h1').remove();
const description = article.html();
return {
title,