rsshub
Version:
Make RSS Great Again!
107 lines (105 loc) • 2.64 kB
JavaScript
import "./esm-shims-CzJ_djXG.mjs";
import "./config-C37vj7VH.mjs";
import { t as ViewType } from "./types-D84BRIt4.mjs";
import "./dist-BInvbO1W.mjs";
import "./logger-Czu8UMNd.mjs";
import "./ofetch-BIyrKU3Y.mjs";
import { n as parseRelativeDate } from "./parse-date-BrP7mxXf.mjs";
import "./helpers-DxBp0Pty.mjs";
import { t as got_default } from "./got-KxxWdaxq.mjs";
//#region lib/routes/moodysmismicrosite/report.ts
const route = {
path: "/report/:industry?",
categories: ["finance"],
view: ViewType.Articles,
example: "/moodysmismicrosite/report/企业&金融机构",
parameters: { industry: {
description: "可选参数,默认为全部行业。行业选择,支持使用&连接多个。",
options: [
{
value: "0",
label: "企业"
},
{
value: "1",
label: "金融机构"
},
{
value: "2",
label: "主权"
},
{
value: "3",
label: "地方政府及城投公司"
},
{
value: "4",
label: "宏观经济"
},
{
value: "5",
label: "结构融资"
},
{
value: "6",
label: "基础设施及项目融资"
},
{
value: "7",
label: "ESG"
},
{
value: "8",
label: "其他"
}
],
default: "全部"
} },
radar: [{ source: ["www.moodysmismicrosite.com/report"] }],
name: "industry",
description: `
| ID | Description |
| --- | --- |
| 0 | 企业 |
| 1 | 金融机构 |
| 2 | 主权 |
| 3 | 地方政府及城投公司 |
| 4 | 宏观经济 |
| 5 | 结构融资 |
| 6 | 基础设施项目融资 |
| 7 | ESG |
| 8 | 其他 |
`,
maintainers: ["Cedaric"],
handler
};
async function handler(ctx) {
const reversedIndustry = Object.fromEntries(Object.entries({
0: "企业",
1: "金融机构",
2: "主权",
3: "地方政府及城投公司",
4: "宏观经济",
5: "结构融资",
6: "基础设施项目融资",
7: "ESG",
8: "其他"
}).map(([k, v]) => [v, k]));
const industry = ctx.req.param("industry") || "行业";
const items = (await got_default(`https://www.moodysmismicrosite.com/micro/v2/report/list?page_num=1&page_size=25&keyword=&industry_ids=${industry.split("&").map((name) => reversedIndustry[name.trim()]).filter((key) => key !== void 0).join(",")}`))?.data?.data?.list || [];
return {
title: `穆迪评级(${industry})`,
link: "https://www.moodysmismicrosite.com/report",
allowEmpty: true,
item: items.map((x) => ({
title: x.title,
pubDate: parseRelativeDate(x.release_time),
link: `https://www.moodysmismicrosite.com/details/${x.id}`,
description: x.content_profile,
category: x.classification,
guid: x.id
}))
};
}
//#endregion
export { route };