UNPKG

rsshub

Version:
30 lines (29 loc) 968 B
import { t as rofetch } from "./ofetch-W1aeTHCo.mjs"; //#region lib/routes/xiachufang/utils.ts const fetchPage = (url) => rofetch(url, { headers: { Referer: url } }); const generateItems = ($, timeframe) => { return $([ "week", "rising", "monthhonor" ].includes(timeframe ?? "") ? ".normal-recipe-list li" : ".ias-container .pure-u").toArray().map((item) => { const $item = $(item); const $link = $item.find(".name a"); const title = $link.text(); const link = `https://www.xiachufang.com${$link.attr("href")}`; const img = $item.find(".cover img").attr("data-src").replaceAll(/\?.+/g, ""); let desc = $item.find(".ing").text(); if (!desc) desc = $item.find(".desc").text().replaceAll("\n", "<br>"); return { title, link, description: ` <img src="${img}" /><br> <strong>${title}</strong><br> ${desc} ` }; }); }; //#endregion export { generateItems as n, fetchPage as t };