Files
RSSHub/lib/routes/tgbus/utils.ts
T
Xzonn 226fcd8e7c feat(route): Add TGBUS (电玩巴士) (#14821)
* feat(route): Add TGBUS (电玩巴士)

* feat(route): Update TGBUS (电玩巴士)

* docs: fix parameters

---------
2024-03-19 12:50:46 +08:00

20 lines
657 B
TypeScript

import got from '@/utils/got';
import { load } from 'cheerio';
import { parseDate } from '@/utils/parse-date';
import timezone from '@/utils/timezone';
const parseArticle = (item, tryGet) =>
tryGet(item.link, async () => {
const { data: response } = await got(item.link);
const $ = load(response as unknown as string);
const infoBox = $('div.info-box');
item.author = infoBox.find('b:nth-child(4)').text().trim();
item.pubDate = timezone(parseDate(infoBox.find('i:last-child').text()), 8);
item.description = $('.article-main-contentraw').html();
return item;
});
export { parseArticle };