UNPKG

rsshub

Version:
23 lines (21 loc) 1.26 kB
import { t as parseDate } from "./parse-date-BrP7mxXf.mjs"; import { t as got_default } from "./got-KxxWdaxq.mjs"; import { t as timezone } from "./timezone-D8cuwzTY.mjs"; import { load } from "cheerio"; //#region lib/routes/oeeee/utils.ts const parseArticle = (item, tryGet) => tryGet(item.link, async () => { const content = load((await got_default({ method: "get", url: item.link })).data); if (content(".post-cont") && content(".post-cont").html()) { content("img").removeAttr("data-width").removeAttr("data-height").removeAttr("class").removeAttr("title").removeAttr("referrerpolicy"); content(".taglist, .J_ndlogo, .zan-shang, .sourcelist-box, #shareContain, .buyCopyright, .article-info, .icon, .special").remove(); item.description += content(".post-cont").html().replaceAll(/data:image\S*=="\s*\n*\s*original="/g, "") ?? ""; if (!item.pubDate) item.pubDate = timezone(parseDate(content(".introduce").text().split()), 8); } else if (content(".content") && content(".content").html()) item.description += content(".content").html() ?? ""; else if (content(".article-conten") && content(".article-conten").html()) item.description += content(".article-conten").html() ?? ""; return item; }); //#endregion export { parseArticle as t };