rsshub
Version:
Make RSS Great Again!
66 lines (64 loc) • 1.92 kB
JavaScript
import "./esm-shims-CzJ_djXG.mjs";
import "./config-C37vj7VH.mjs";
import "./dist-BInvbO1W.mjs";
import "./logger-Czu8UMNd.mjs";
import { t as ofetch_default } from "./ofetch-BIyrKU3Y.mjs";
import { t as parseDate } from "./parse-date-BrP7mxXf.mjs";
import markdownit from "markdown-it";
//#region lib/routes/huawei/developer/harmonyos/samplecode.ts
const md = markdownit({ html: true });
const route = {
path: "/developer/harmonyos/sample-code",
categories: ["programming"],
example: "/huawei/developer/harmonyos/sample-code",
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false
},
radar: [{
source: ["developer.huawei.com/consumer/cn/samples"],
target: "/huawei/developer/harmonyos/sample-code"
}],
name: "HarmonyOS 示例代码",
maintainers: ["JiZhi-Error"],
handler
};
async function handler() {
return {
title: "HarmonyOS 示例代码 - 华为开发者联盟",
link: "https://developer.huawei.com/consumer/cn/samples/",
description: "华为鸿蒙系统示例代码更新",
language: "zh-CN",
item: (await ofetch_default("https://svc-drcn.developer.huawei.com/community/servlet/consumer/partnerCommunityService/v1/servlet/samplecode/getSampleCodes", {
method: "POST",
headers: {
"content-type": "application/json",
origin: "https://developer.huawei.com",
referer: "https://developer.huawei.com/"
},
body: JSON.stringify({
classifyId: "",
classifyIdList: [],
keywords: "",
language: "zh",
pageIndex: 1,
pageSize: 100
})
})).resultList.map((item) => ({
title: md.renderInline(item.name),
link: item.link,
description: md.render(item.description),
category: item.keywords,
pubDate: parseDate(item.updateTime),
author: "HarmonyOS",
id: item.id,
image: item.effectPictureUrl
}))
};
}
//#endregion
export { route };