get-thepaper-trending
Track trending news on The Paper, covering politics, finance, social issues, culture, and in-depth reports from China. Stay updated with current events and key developments.
Instructions
获取澎湃新闻热榜,包含时政要闻、财经动态、社会事件、文化教育及深度报道的高质量中文新闻资讯
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/thepaper.ts:6-28 (handler)The handler function fetches trending news from The Paper API, validates the response, processes the hotNews array, and returns formatted items with title, cover, popularity, publish time, hashtags, and link.func: async () => { const resp = await http.get<{ resultCode: number; resultMsg: string; data: { hotNews: any[]; }; }>('https://cache.thepaper.cn/contentapi/wwwIndex/rightSidebar'); if (resp.data.resultCode !== 1 || !Array.isArray(resp.data.data.hotNews)) { throw new Error(resp.data.resultMsg || '获取澎湃新闻热榜失败'); } return resp.data.data.hotNews.map((item) => { return { title: item.name, cover: item.pic, popularity: item.praiseTimes, publish_time: dayjs(item.pubTimeLong).toISOString(), hashtags: item.tagList?.map((tag: any) => `#${tag.tag}`).join(' '), link: `https://www.thepaper.cn/newsDetail_forward_${item.contId}`, }; }); },
- src/tools/thepaper.ts:3-29 (registration)The tool is registered using defineToolConfig with the name 'get-thepaper-trending', a description in Chinese, and references the handler function.export default defineToolConfig({ name: 'get-thepaper-trending', description: '获取澎湃新闻热榜,包含时政要闻、财经动态、社会事件、文化教育及深度报道的高质量中文新闻资讯', func: async () => { const resp = await http.get<{ resultCode: number; resultMsg: string; data: { hotNews: any[]; }; }>('https://cache.thepaper.cn/contentapi/wwwIndex/rightSidebar'); if (resp.data.resultCode !== 1 || !Array.isArray(resp.data.data.hotNews)) { throw new Error(resp.data.resultMsg || '获取澎湃新闻热榜失败'); } return resp.data.data.hotNews.map((item) => { return { title: item.name, cover: item.pic, popularity: item.praiseTimes, publish_time: dayjs(item.pubTimeLong).toISOString(), hashtags: item.tagList?.map((tag: any) => `#${tag.tag}`).join(' '), link: `https://www.thepaper.cn/newsDetail_forward_${item.contId}`, }; }); }, });