get-weibo-trending
Retrieve real-time trending topics from Weibo's hot search list to monitor Chinese social media discussions about current events, entertainment, and popular culture.
Instructions
获取微博热搜榜,包含时事热点、社会现象、娱乐新闻、明星动态及网络热议话题的实时热门中文资讯
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/weibo.ts:7-32 (handler)The handler function fetches Weibo trending topics from 'https://weibo.com/ajax/side/hotSearch', filters out ads, formats each topic with title, description, popularity, and search link.func: async () => { const resp = await http.get<{ ok: number; data: { realtime: any[]; }; }>('https://weibo.com/ajax/side/hotSearch'); if (resp.data.ok !== 1 || !Array.isArray(resp.data.data.realtime)) { throw new Error('获取微博热搜榜失败'); } return resp.data.data.realtime .filter((item) => item.is_ad !== 1) .map((item: any) => { const key = item.word_scheme || `#${item.word}`; const url = new URL('https://s.weibo.com/weibo'); url.searchParams.set('q', key); url.searchParams.set('band_rank', '1'); url.searchParams.set('Refer', 'top'); return { title: item.word, description: item.note || key, popularity: item.num, link: url.toString(), }; }); },
- src/tools/weibo.ts:4-33 (registration)Tool registration using defineToolConfig, defining name 'get-weibo-trending', description, and references the handler function.export default defineToolConfig({ name: 'get-weibo-trending', description: '获取微博热搜榜,包含时事热点、社会现象、娱乐新闻、明星动态及网络热议话题的实时热门中文资讯', func: async () => { const resp = await http.get<{ ok: number; data: { realtime: any[]; }; }>('https://weibo.com/ajax/side/hotSearch'); if (resp.data.ok !== 1 || !Array.isArray(resp.data.data.realtime)) { throw new Error('获取微博热搜榜失败'); } return resp.data.data.realtime .filter((item) => item.is_ad !== 1) .map((item: any) => { const key = item.word_scheme || `#${item.word}`; const url = new URL('https://s.weibo.com/weibo'); url.searchParams.set('q', key); url.searchParams.set('band_rank', '1'); url.searchParams.set('Refer', 'top'); return { title: item.word, description: item.note || key, popularity: item.num, link: url.toString(), }; }); }, });