rsshub
Version:
Make RSS Great Again!
38 lines (37 loc) • 1.11 kB
JavaScript
import { t as rofetch } from "./ofetch-W1aeTHCo.mjs";
import { load } from "cheerio";
//#region lib/routes/dekudeals/index.ts
const route = {
path: "/:type",
categories: ["game"],
example: "/dekudeals/most-wanted",
parameters: { type: "Category name" },
name: "Category",
maintainers: ["LogicJake"],
handler
};
async function handler(ctx) {
const { type } = ctx.req.param();
const host = "https://www.dekudeals.com/";
const link = new URL(type, host).href;
const $ = load(await rofetch(link));
const title = $("#search-title").text();
const out = $(".search-main > .item-grid2 > div.cell").toArray().map((item) => {
const $item = $(item);
const img = $item.find(".main-link img").attr("src");
const price = $item.find("strong").html();
const oldprice = $item.find("s.text-muted").html();
return {
title: $item.find(".name").text(),
link: new URL($item.find(".main-link").attr("href"), host).href,
description: `<img src="${img}"><br><s>${oldprice}</s><br>${price}`
};
});
return {
title: `${title}—dekudeals`,
link,
item: out
};
}
//#endregion
export { route };