get-36kr-trending
Retrieve trending news and insights on startups, business, and technology from 36Kr. Access real-time rankings for investment trends, industry analysis, and innovation updates.
Instructions
获取 36 氪热榜,提供创业、商业、科技领域的热门资讯,包含投融资动态、新兴产业分析和商业模式创新信息
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| type | No | 分类 | hot |
Implementation Reference
- src/tools/36kr.ts:28-64 (handler)The tool handler function: parses input args, performs HTTP POST request to 36Kr API endpoint based on type, processes the response data, and maps it to a structured output array of trending items.func: async (args) => { const { type } = get36krRequestSchema.parse(args); const resp = await http.post<{ data: Record<string, any[]>; }>( `https://gateway.36kr.com/api/mis/nav/home/nav/rank/${type}`, { partner_id: 'wap', param: { siteId: 1, platformId: 2, }, timestamp: Date.now(), }, { headers: { 'Content-Type': 'application/json; charset=utf-8', }, }, ); return resp.data.data[LIST_TYPE_MAP[type]].map((item) => { const data = item.templateMaterial; return { title: data.widgetTitle, cover: data.widgetImage, author: data.authorName, publish_time: dayjs(data.publishTime).toISOString(), read_count: data.statRead, collect_count: data.statCollect, comment_count: data.statComment, praise_count: data.statPraise, link: `https://www.36kr.com/p/${data.itemId}`, }; }); },
- src/tools/36kr.ts:4-15 (schema)Zod input schema defining the 'type' parameter for the tool, with options for different trending lists and default to 'hot'.const get36krRequestSchema = z.object({ type: z .union([ z.literal('hot').describe('人气榜'), z.literal('video').describe('视频榜'), z.literal('comment').describe('热议榜'), z.literal('collect').describe('收藏榜'), ]) .optional() .default('hot') .describe('分类'), });
- src/tools/36kr.ts:24-65 (registration)Tool registration using defineToolConfig, specifying the name 'get-36kr-trending', description, input schema, and handler function.export default defineToolConfig({ name: 'get-36kr-trending', description: '获取 36 氪热榜,提供创业、商业、科技领域的热门资讯,包含投融资动态、新兴产业分析和商业模式创新信息', zodSchema: get36krRequestSchema, func: async (args) => { const { type } = get36krRequestSchema.parse(args); const resp = await http.post<{ data: Record<string, any[]>; }>( `https://gateway.36kr.com/api/mis/nav/home/nav/rank/${type}`, { partner_id: 'wap', param: { siteId: 1, platformId: 2, }, timestamp: Date.now(), }, { headers: { 'Content-Type': 'application/json; charset=utf-8', }, }, ); return resp.data.data[LIST_TYPE_MAP[type]].map((item) => { const data = item.templateMaterial; return { title: data.widgetTitle, cover: data.widgetImage, author: data.authorName, publish_time: dayjs(data.publishTime).toISOString(), read_count: data.statRead, collect_count: data.statCollect, comment_count: data.statComment, praise_count: data.statPraise, link: `https://www.36kr.com/p/${data.itemId}`, }; }); }, });
- src/tools/36kr.ts:17-22 (helper)Mapping object that translates input 'type' values to corresponding API list keys used in the response data access.const LIST_TYPE_MAP: Record<z.infer<typeof get36krRequestSchema>['type'], string> = { hot: 'hotRankList', video: 'videoList', comment: 'remarkList', collect: 'collectList', };