Files
RSSHub/lib/routes/csust/utils.ts
T
Tony 5527d18de9 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
2026-07-27 22:23:57 +08:00

22 lines
600 B
TypeScript

import { load } from 'cheerio';
import type { DataItem } from '@/types';
import got from '@/utils/got';
type NoticeItem = DataItem & { link: string };
export async function getNoticeContent(item: NoticeItem): Promise<NoticeItem> {
const response = await got(item.link);
const $ = load(response.body);
const pageTitle = $('title').text();
const $content = $('.v_news_content');
$content.find('style, .vsbcontent_end').remove();
return {
...item,
title: pageTitle.slice(0, pageTitle.lastIndexOf('-')).trim(),
description: $content.html()!,
};
}