UNPKG

rsshub

Version:
78 lines (72 loc) 2.34 kB
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 { t as generateRssData } from "./utils-BNA7_Wci.mjs"; import path from "node:path"; //#region lib/routes/arcteryx/new-arrivals.ts init_esm_shims(); const route = { path: "/new-arrivals/:country/:gender", categories: ["shopping"], example: "/arcteryx/new-arrivals/us/mens", parameters: { country: "country", gender: "gender" }, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: true, supportBT: false, supportPodcast: false, supportScihub: false }, radar: [{ source: ["arcteryx.com/:country/en/c/:gender/new-arrivals"] }], name: "New Arrivals", maintainers: ["EthanWng97"], handler, description: `Country | United States | Canada | United Kingdom | | ------------- | ------ | -------------- | | us | ca | gb | gender | male | female | | ---- | ------ | | mens | womens | ::: tip Parameter \`country\` can be found within the url of \`Arcteryx\` website. :::` }; async function handler(ctx) { const { country, gender } = ctx.req.param(); const host = `https://arcteryx.com/${country}/en/`; const url = `${host}api/fredhopper/query`; const productUrl = `${host}shop/`; const pageUrl = `${host}c/${gender}/new-arrivals`; const items = (await got_default({ method: "get", url, searchParams: { fh_location: `//catalog01/en_CA/gender>{${gender}}/intended_use>{newarrivals}`, fh_country: country, fh_view_size: "all" } })).data.universes.universe[1]["items-section"].items.item.map((item, index, arr) => generateRssData(item, index, arr, country)); return { title: `Arcteryx - New Arrivals(${country.toUpperCase()}) - ${gender.toUpperCase()}`, link: pageUrl, description: `Arcteryx - New Arrivals(${country.toUpperCase()}) - ${gender.toUpperCase()}`, item: items.map((item) => ({ title: item.name, link: productUrl + item.slug, description: art(path.join(__dirname, "templates/product-description-3714d586.art"), { item }) })) }; } //#endregion export { route };