get-toutiao-trending
Fetch trending content from Toutiao, including political news, social events, international updates, tech developments, and entertainment gossip in Chinese.
Instructions
获取今日头条热榜,包含时政要闻、社会事件、国际新闻、科技发展及娱乐八卦等多领域的热门中文资讯
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/toutiao.ts:7-28 (handler)The main handler function that executes the tool logic: fetches data from Toutiao's hot board API, validates the response, processes items to extract title, cover image, popularity, and clean link.func: async () => { const resp = await http.get<{ data: any[]; }>('https://www.toutiao.com/hot-event/hot-board/', { params: { origin: 'toutiao_pc', }, }); if (!Array.isArray(resp.data.data)) { throw new Error('获取今日头条热榜失败'); } return resp.data.data.map((item) => { const link = new URL(item.Url); link.search = ''; return { title: item.Title, cover: item.Image.url, popularity: item.HotValue, link: link.toString(), }; }); },
- src/tools/toutiao.ts:4-29 (registration)The tool registration using defineToolConfig, specifying the name 'get-toutiao-trending', description, and references the handler function.export default defineToolConfig({ name: 'get-toutiao-trending', description: '获取今日头条热榜,包含时政要闻、社会事件、国际新闻、科技发展及娱乐八卦等多领域的热门中文资讯', func: async () => { const resp = await http.get<{ data: any[]; }>('https://www.toutiao.com/hot-event/hot-board/', { params: { origin: 'toutiao_pc', }, }); if (!Array.isArray(resp.data.data)) { throw new Error('获取今日头条热榜失败'); } return resp.data.data.map((item) => { const link = new URL(item.Url); link.search = ''; return { title: item.Title, cover: item.Image.url, popularity: item.HotValue, link: link.toString(), }; }); }, });