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