rsshub
Version:
Make RSS Great Again!
36 lines (35 loc) • 1.36 kB
JavaScript
import { t as rofetch } from "./ofetch-W1aeTHCo.mjs";
import { t as parseDate } from "./parse-date-CjhZE69i.mjs";
//#region lib/routes/microsoft/updates.ts
const route = {
path: "/store/updates/:productid/:market?",
categories: ["program-update"],
example: "/microsoft/store/updates/9WZDNCRFHVN5/CN",
parameters: {
productid: "`Share` - `Copy Link` in the Store",
market: "`CN` as default"
},
name: "Store Updates",
maintainers: ["hellodword"],
handler
};
async function handler(ctx) {
const { market = "CN", productid } = ctx.req.param();
const CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
const data = await rofetch(`https://displaycatalog.mp.microsoft.com/v7.0/products/${productid}/?fieldsTemplate=&market=${market}&languages=en`, { headers: {
"Content-Type": "application/json",
"MS-CV": `${Array.from({ length: 16 }, () => CHARS.charAt(Math.floor(Math.random() * 62))).join("")}.1`
} });
const link = `https://www.microsoft.com/store/productId/${productid}`;
return {
title: `${data.Product.LocalizedProperties[0].ProductTitle} - Microsoft Store Updates`,
link,
item: [{
title: data.Product.DisplaySkuAvailabilities[0].Sku.Properties.Packages[0].PackageFullName,
pubDate: parseDate(data.Product.DisplaySkuAvailabilities[0].Sku.LastModifiedDate),
link
}]
};
}
//#endregion
export { route };