* 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
23 lines
633 B
TypeScript
23 lines
633 B
TypeScript
import { load } from 'cheerio';
|
|
|
|
import { parseDate } from '@/utils/parse-date';
|
|
import timezone from '@/utils/timezone';
|
|
|
|
const rootUrl = 'https://p-articles.com';
|
|
|
|
const ProcessFeed = (info, data) => {
|
|
// const $ = cheerio.load(data);
|
|
const $ = load(data);
|
|
const author = $('div.detail_title_02 > h4 > a:nth-child(2)').text();
|
|
info.author = author;
|
|
|
|
const dateValue = $('div.detail_title_02 > h4 ').text();
|
|
info.pubDate = timezone(parseDate(dateValue), 8);
|
|
|
|
const description = $('div.detail_contect_01').html();
|
|
info.description = description;
|
|
return info;
|
|
};
|
|
|
|
export { ProcessFeed, rootUrl };
|