UNPKG

rsshub

Version:
35 lines (34 loc) 1.28 kB
import { t as cache_default } from "./cache-C1Y-9qDV.mjs"; import { t as got_default } from "./got-DUpa1V3-.mjs"; import { load } from "cheerio"; //#region lib/routes/1lou/util.ts const rootUrl = "https://www.1lou.me"; const parseItems = async (items, language) => await Promise.all(items.map((item) => cache_default.tryGet(item.link, async () => { const { data: detailResponse } = await got_default(item.link); const $$ = load(detailResponse); const title = $$("h4.break-all").contents().last().text(); if (title) { const description = $$("div.message.break-all").html(); const image = new URL($$("img").first().prop("src"), rootUrl).href; item.title = title; item.description = description; item.category = $$("a.badge").toArray().map((c) => $$(c).text()); item.content = { html: description, text: $$("div.message.break-all").text() }; item.image = image; item.banner = image; item.language = language; const torrents = $$("ul.attachlist li a"); if (torrents.length > 0) { const torrent = torrents.first(); item.enclosure_url = new URL(torrent.prop("href"), rootUrl).href; item.enclosure_type = "application/x-bittorrent"; item.enclosure_title = torrent.text(); } } return item; }))); //#endregion export { parseItems as t };