UNPKG

rsshub

Version:
37 lines (36 loc) 1.32 kB
import { t as rofetch } from "./ofetch-W1aeTHCo.mjs"; import { t as parseDate } from "./parse-date-CjhZE69i.mjs"; import { t as timezone } from "./timezone-DE--ze1V.mjs"; import { load } from "cheerio"; //#region lib/routes/sou-yun/today.ts const route = { path: "/today", categories: ["study"], example: "/sou-yun/today", name: "诗词日历", maintainers: ["nczitzk"], handler }; async function handler() { const currentUrl = "https://sou-yun.cn/AncientToday.aspx"; const poemUrl = "https://api.sou-yun.cn/api/RecommendedReading?type=poem&needHtml=true"; const wordUrl = "https://api.sou-yun.cn/api/RecommendedReading?type=word"; const response = await rofetch(currentUrl); const poemResponse = await rofetch(poemUrl, { headers: { Accept: "application/json" } }); const wordResponse = await rofetch(wordUrl, { headers: { Accept: "application/json" } }); const $ = load(response); const birthday = $("span.titleHint").parent().html(); const today = $("input[name=\"LastSelectedDate\"]").attr("value"); return { title: "搜韵网 - 诗词日历", link: currentUrl, item: [{ title: poemResponse.Date, link: currentUrl, description: `${poemResponse.Content.Text}<br>${birthday}<br>${wordResponse.Content.Text}`, pubDate: timezone(parseDate(today), 8) }] }; } //#endregion export { route };