get-36kr-trending
Fetch trending content from 36Kr to access startup, business, and technology insights including investment updates, emerging industry analysis, and business model innovations.
Instructions
获取 36 氪热榜,提供创业、商业、科技领域的热门资讯,包含投融资动态、新兴产业分析和商业模式创新信息
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| type | No | 分类 | hot |
Implementation Reference
- src/tools/36kr.ts:28-64 (handler)The async function that implements the tool logic: parses input with schema, fetches data from 36kr API via POST request, processes the response data into a list of trending items with fields like title, cover, author, etc.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 schema for input: object with optional 'type' union of 'hot', 'video', 'comment', 'collect' defaulting 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 with name 'get-36kr-trending', description, zodSchema, and func handler.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 of type to list key in API response, e.g., hot -> 'hotRankList'.const LIST_TYPE_MAP: Record<z.infer<typeof get36krRequestSchema>['type'], string> = { hot: 'hotRankList', video: 'videoList', comment: 'remarkList', collect: 'collectList', };