UNPKG

rsshub

Version:
89 lines (87 loc) 2.79 kB
import "./dist-Bog6z_OM.mjs"; import "./config-MQ-7ebJ_.mjs"; import "./logger-C4avouvV.mjs"; import "./ofetch-DKl_Ma9g.mjs"; import "./helpers-Bo4JQYdN.mjs"; import { t as got_default } from "./got-CO-ndVl2.mjs"; import { Fragment, jsx, jsxs } from "hono/jsx/jsx-runtime"; import { load } from "cheerio"; import { renderToString } from "hono/jsx/dom/server"; //#region lib/routes/arcteryx/regear-new-arrivals.tsx const host = "https://www.regear.arcteryx.com"; function getUSDPrice(number) { return (number / 100).toLocaleString("en-US", { style: "currency", currency: "USD" }); } const route = { path: "/regear/new-arrivals", categories: ["shopping"], example: "/arcteryx/regear/new-arrivals", parameters: {}, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, radar: [{ source: ["regear.arcteryx.com/shop/new-arrivals", "regear.arcteryx.com/"] }], name: "Regear New Arrivals", maintainers: ["EthanWng97"], handler, url: "regear.arcteryx.com/shop/new-arrivals" }; async function handler() { const url = `${host}/shop/new-arrivals`; const data = (await got_default({ method: "get", url })).data; const contents = load(data)("script:contains(\"window.__PRELOADED_STATE__\")").text(); let items = JSON.parse(contents.match(/{.*}/)[0]).shop.items; items = items.filter((item) => item.availableSizes.length !== 0); return { title: "Arcteryx - Regear - New Arrivals", link: url, description: "Arcteryx - Regear - New Arrivals", item: items.map((item) => { const data = { title: item.displayTitle, link: item.pdpLink.url, imgUrl: JSON.parse(item.imageUrls).front, availableSizes: item.availableSizes, color: item.color, originalPrice: getUSDPrice(item.originalPrice), regearPrice: item.priceRange[0] === item.priceRange[1] ? getUSDPrice(item.priceRange[0]) : `${getUSDPrice(item.priceRange[0])} - ${getUSDPrice(item.priceRange[1])}`, description: "" }; data.description = renderToString(/* @__PURE__ */ jsxs("div", { children: [ "Available Sizes:\xA0", data.availableSizes.map((size) => /* @__PURE__ */ jsxs(Fragment, { children: [size, "\xA0"] })), /* @__PURE__ */ jsx("br", {}), "Color: ", data.color, /* @__PURE__ */ jsx("br", {}), "Original Price: ", data.originalPrice, /* @__PURE__ */ jsx("br", {}), "Regear Price: ", data.regearPrice, /* @__PURE__ */ jsx("br", {}), /* @__PURE__ */ jsx("img", { src: data.imgUrl }), /* @__PURE__ */ jsx("br", {}), /* @__PURE__ */ jsx("br", {}) ] })); return data; }).map((item) => ({ title: item.title, link: item.link, description: item.description })) }; } //#endregion export { route };