rsshub
Version:
Make RSS Great Again!
75 lines (73 loc) • 2.37 kB
JavaScript
import { n as init_esm_shims, t as __dirname } from "./esm-shims-CzJ_djXG.mjs";
import "./config-C37vj7VH.mjs";
import "./dist-BInvbO1W.mjs";
import "./logger-Czu8UMNd.mjs";
import "./ofetch-BIyrKU3Y.mjs";
import "./helpers-DxBp0Pty.mjs";
import { t as art } from "./render-BQo6B4tL.mjs";
import { t as got_default } from "./got-KxxWdaxq.mjs";
import path from "node:path";
import { load } from "cheerio";
//#region lib/routes/arcteryx/regear-new-arrivals.ts
init_esm_shims();
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$1 = {
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$1.description = art(path.join(__dirname, "templates/regear-product-description-33a973a2.art"), { data: data$1 });
return data$1;
}).map((item) => ({
title: item.title,
link: item.link,
description: item.description
}))
};
}
//#endregion
export { route };