Skip to main content
Glama

get-douyin-trending

Fetch and display Douyin’s trending topics, including social discussions, entertainment events, and viral trends, via the Trends Hub MCP server.

Instructions

获取抖音热搜榜单,展示当下最热门的社会话题、娱乐事件、网络热点和流行趋势

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the 'get-douyin-trending' tool. It fetches a CSRF token, makes an HTTP GET request to the Douyin hot search API, processes the response, and returns a list of trending items with title, event time, cover image, popularity, and link.
    func: async () => { const csrfToken = await getCsrfToken(); const resp = await http.get<{ status_code: number; data: { word_list: any[]; }; }>('https://www.douyin.com/aweme/v1/web/hot/search/list/', { params: { device_platform: 'webapp', aid: 6383, channel: 'channel_pc_web', detail_list: 1, }, headers: { Cookie: `passport_csrf_token=${csrfToken}`, }, }); if (resp.data?.status_code !== 0 || !Array.isArray(resp.data.data.word_list)) { throw new Error('获取抖音热榜失败'); } return resp.data.data.word_list.map((item) => { return { title: item.word, eventTime: dayjs.unix(item.event_time).toISOString(), cover: item.word_cover?.url_list?.[0], popularity: item.hot_value, link: `https://www.douyin.com/hot/${item.sentence_id}`, }; }); },
  • Helper function that retrieves the CSRF token from Douyin's login strategy endpoint by parsing the Set-Cookie header.
    const getCsrfToken = async () => { try { const reps = await http.get('https://www.douyin.com/passport/general/login_guiding_strategy/', { params: { aid: 6383, }, }); const pattern = /passport_csrf_token=([^;]*); Path/; const matchResult = reps.headers['set-cookie']?.[0].match(pattern); const csrfToken = matchResult?.[1]; return csrfToken; } catch (error) { return undefined; } };
  • Tool registration via defineToolConfig, defining the name, description, and handler for the 'get-douyin-trending' MCP tool.
    export default defineToolConfig({ name: 'get-douyin-trending', description: '获取抖音热搜榜单,展示当下最热门的社会话题、娱乐事件、网络热点和流行趋势', func: async () => { const csrfToken = await getCsrfToken(); const resp = await http.get<{ status_code: number; data: { word_list: any[]; }; }>('https://www.douyin.com/aweme/v1/web/hot/search/list/', { params: { device_platform: 'webapp', aid: 6383, channel: 'channel_pc_web', detail_list: 1, }, headers: { Cookie: `passport_csrf_token=${csrfToken}`, }, }); if (resp.data?.status_code !== 0 || !Array.isArray(resp.data.data.word_list)) { throw new Error('获取抖音热榜失败'); } return resp.data.data.word_list.map((item) => { return { title: item.word, eventTime: dayjs.unix(item.event_time).toISOString(), cover: item.word_cover?.url_list?.[0], popularity: item.hot_value, link: `https://www.douyin.com/hot/${item.sentence_id}`, }; }); }, });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/baranwang/mcp-trends-hub'

If you have feedback or need assistance with the MCP directory API, please join our Discord server