get-netease-news-trending
Fetch trending news from NetEase covering politics, society, finance, technology, and entertainment in Chinese.
Instructions
获取网易新闻热点榜,包含时政要闻、社会事件、财经资讯、科技动态及娱乐体育的全方位中文新闻资讯
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/netease-news.ts:6-26 (handler)The core handler function that fetches trending news from the Netease API endpoint 'https://m.163.com/fe/api/hot/news/flow', validates the response, and maps the list to objects containing title, cover image, source, publish time, and link.func: async () => { const resp = await http.get<{ code: number; data: { list: any[]; }; }>('https://m.163.com/fe/api/hot/news/flow'); if (resp.data.code !== 200 || !Array.isArray(resp.data.data.list)) { throw new Error('获取网易新闻热点榜失败'); } return resp.data.data.list.map((item) => { return { title: item.title, cover: item.imgsrc, source: item.source, publish_time: item.ptime, link: item.url, }; }); },
- src/tools/netease-news.ts:3-27 (registration)The tool is registered via export default of defineToolConfig, which provides the name, description, and references the handler function. This config is dynamically loaded by src/index.ts using webpackContext.export default defineToolConfig({ name: 'get-netease-news-trending', description: '获取网易新闻热点榜,包含时政要闻、社会事件、财经资讯、科技动态及娱乐体育的全方位中文新闻资讯', func: async () => { const resp = await http.get<{ code: number; data: { list: any[]; }; }>('https://m.163.com/fe/api/hot/news/flow'); if (resp.data.code !== 200 || !Array.isArray(resp.data.data.list)) { throw new Error('获取网易新闻热点榜失败'); } return resp.data.data.list.map((item) => { return { title: item.title, cover: item.imgsrc, source: item.source, publish_time: item.ptime, link: item.url, }; }); }, });