rsshub
Version:
Make RSS Great Again!
59 lines (57 loc) • 2.04 kB
JavaScript
import "./esm-shims-CzJ_djXG.mjs";
import "./config-C37vj7VH.mjs";
import "./dist-BInvbO1W.mjs";
import "./logger-Czu8UMNd.mjs";
import "./ofetch-BIyrKU3Y.mjs";
import { t as parseDate } from "./parse-date-BrP7mxXf.mjs";
import { t as cache_default } from "./cache-Bo__VnGm.mjs";
import "./helpers-DxBp0Pty.mjs";
import { t as got_default } from "./got-KxxWdaxq.mjs";
import { t as timezone } from "./timezone-D8cuwzTY.mjs";
import { load } from "cheerio";
import iconv from "iconv-lite";
//#region lib/routes/flyert/preferential.ts
const gbk2utf8 = (s) => iconv.decode(s, "gbk");
const host = "https://www.flyert.com";
const target = `${host}/forum.php?mod=forumdisplay&sum=all&fid=all&catid=322`;
const route = {
path: "/preferential",
categories: ["travel"],
example: "/flyert/preferential",
parameters: {},
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false
},
radar: [{ source: ["flyert.com/"] }],
name: "优惠信息",
maintainers: ["howel52"],
handler,
url: "flyert.com/"
};
async function handler() {
const $ = load(gbk2utf8((await got_default(target, { responseType: "buffer" })).data));
const list = $(".comiis_wzli").toArray().map((item) => ({
title: $(item).find(".wzbt").text(),
link: `${host}/${$(item).find(".wzbt a").attr("href")}`,
description: $(item).find(".wznr > div:first-child").text()
}));
return {
title: "飞客茶馆优惠",
link: "https://www.flyert.com/",
description: "飞客茶馆优惠",
item: await Promise.all(list.map((item) => cache_default.tryGet(item.link, async () => {
const content = load(gbk2utf8((await got_default(item.link, { responseType: "buffer" })).data));
content("div.artical_top").remove();
item.description = content("#artMain").html();
item.pubDate = timezone(parseDate(content("p.xg1 > span:nth-child(1)").attr("title") || content("p.xg1").text().split("|")[0], "YYYY-M-D HH:mm"), 8);
return item;
})))
};
}
//#endregion
export { route };