# How to have AI build a social media dashboard for Douyin, Xiaohongshu and WeChat (2026)

Give the AI the accounts you follow and the script below: it reads each account's newest posts, keeps each one once in a local database, and writes a web page and a CSV file. 3 endpoints do it: Douyin user videos → Xiaohongshu user notes → WeChat Official Account articles. The worked example below is 3 calls and costs $0.0420 in all; a failed call is not charged.

Updated 2026-11-29

You end up with three files: `workbench.db` (every post kept so far), `workbench.html` (the dashboard, opened in a browser, with the posts found for the first time marked NEW) and `posts.csv` (which Excel opens). Running it again refreshes them.

## Step by step

### Step 1: Douyin user videos

Get the newest page of a Douyin account's videos. `id` is the account ID (the string starting with MS4w); with only a profile link, put the link into `url`. Each video's ID is in `id`, its counts in `metrics`. ([Douyin user videos](https://dataxapi.com/apis/douyin/users/videos/list/), $0.0020 / a call)

cURL

```bash
curl -G "https://api.dataxapi.com/v1/douyin/users/videos/list" \
  --data-urlencode "id=MS4wLjABAAAAZ0aPDJzFhBrs0q3wVsp2a9WWrBuAUMsVyygoaO0bCw8" \
  -H "Authorization: Bearer $DATAXAPI_API_KEY"
```

Python

```python
# pip install dataxapi
from dataxapi import DataXAPI

dx = DataXAPI()  # reads DATAXAPI_API_KEY
result = dx.douyin.users.videos.list(id="MS4wLjABAAAAZ0aPDJzFhBrs0q3wVsp2a9WWrBuAUMsVyygoaO0bCw8")
print(result["data"]["items"])
```

TypeScript

```typescript
// npm i @dataxapi/sdk
import { DataXAPI } from "@dataxapi/sdk";

const dx = new DataXAPI(); // reads DATAXAPI_API_KEY
const result = await dx.douyin.users.videos.list({ id: "MS4wLjABAAAAZ0aPDJzFhBrs0q3wVsp2a9WWrBuAUMsVyygoaO0bCw8" });
console.log(result.data.items);
```

CLI

```bash
dataxapi call douyin.users.videos.list id=MS4wLjABAAAAZ0aPDJzFhBrs0q3wVsp2a9WWrBuAUMsVyygoaO0bCw8
```

Recorded response: From a response recorded 2026-10-29 11:25 UTC. Names, text and IDs are examples, and so are the links: none is the recorded one (the page shows no one's personal data); the figures are as recorded. Long lists are cut. The request ID, cursor and balance are made up.

```jsonc
{
  "code": "ok",
  "request_id": "c2504d6c-2152-4538-a486-725d6f7948f6",
  "data": {
    "items": [
      {
        "id": "7302312618550095845",
        "url": "https://www.douyin.com/video/7302312618550095845",
        "type": "video",
        "title": "关于周末露营，我踩过的五个坑",
        "text": "把周末露营从头到尾讲清楚，看完少走弯路",
        "lang": "zh",
        "published_at": "2026-10-28T13:00:00.000Z",
        "author": {
          "id": "MS4wLjABAAAAISQZJVj44x7UmGOrbYT9MYgZqmQZXyVYh0J_KeP0bY6",
          "username": "orange_soda22",
          "name": "橘子汽水不加冰",
          "avatar_url": "https://p3-pc.douyinpic.com/aweme/100x100/aweme-avatar/tos-cn-avt-0015_edc4afa9b9ce65d8c81c.jpeg"
        },
        "metrics": {
          "likes": 9137,
          "comments": 822,
          "shares": 2501,
          "favorites": 1252
        },
        "images": null,
        "hashtags": [
          "户外生活",
          "好物分享",
          // … 3 more
        ],
        "is_pinned": false
      },
      // … 19 more
    ]
  },
  "page": {
    "next_cursor": "c1.WtpNZgnDx-u92cDS4sHsDBAjGm-hJOPNKEKmB3hJ",
    "cursor_expires_at": "2026-10-29T12:25:19.000Z",
    "has_more": true,
    "returned": 20
  },
  "warnings": [],
  "meta": {
    "capability": "douyin.users.videos.list",
    "result_status": "complete",
    "fetched_at": "2026-10-29T11:25:19.000Z",
    "cached": false,
    "replayed": false,
    "unavailable": {
      "metrics.views": "capability",
      "metrics.reposts": "platform",
      "author.verified": "capability",
      "mentions": "capability",
      "post_id": "platform",
      "parent_id": "platform",
      "root_id": "platform",
      "author.followers": "capability"
    },
    "billing": {
      "amount": "0.002",
      "currency": "USD",
      "balance_after": "9.998"
    }
  }
}
```

### Step 2: Xiaohongshu user notes

Get the newest page of a Xiaohongshu account's notes. `id` is the 24-character user ID, or put the profile link into `url`. The fields the script uses have the same names as in step 1 (there is no `url` here), so the same code stores both. ([Xiaohongshu user notes](https://dataxapi.com/apis/xiaohongshu/users/notes/list/), $0.0200 / a call)

cURL

```bash
curl -G "https://api.dataxapi.com/v1/xiaohongshu/users/notes/list" \
  --data-urlencode "id=63bed214000000002702b862" \
  -H "Authorization: Bearer $DATAXAPI_API_KEY"
```

Python

```python
# pip install dataxapi
from dataxapi import DataXAPI

dx = DataXAPI()  # reads DATAXAPI_API_KEY
result = dx.xiaohongshu.users.notes.list(id="63bed214000000002702b862")
print(result["data"]["items"])
```

TypeScript

```typescript
// npm i @dataxapi/sdk
import { DataXAPI } from "@dataxapi/sdk";

const dx = new DataXAPI(); // reads DATAXAPI_API_KEY
const result = await dx.xiaohongshu.users.notes.list({ id: "63bed214000000002702b862" });
console.log(result.data.items);
```

CLI

```bash
dataxapi call xiaohongshu.users.notes.list id=63bed214000000002702b862
```

Recorded response: From a response recorded 2026-10-12 19:13 UTC. Names, text and IDs are examples, and so are the links: none is the recorded one (the page shows no one's personal data); the figures are as recorded. Long lists are cut. The request ID, cursor and balance are made up.

```jsonc
{
  "code": "ok",
  "request_id": "207ddb09-2a0d-4ff5-8cd3-9ddce35b46a5",
  "data": {
    "items": [
      {
        "id": "676ed1bc00000000d870f54e",
        "type": "video",
        "title": "实测一个月周末露营，结论有点意外",
        "text": "周末的周末露营日常，随手记录一下",
        "published_at": "2026-10-12T01:00:27.000Z",
        "author": {
          "id": "6998fff50000000046ca2f74",
          "name": "南边的风",
          "avatar_url": "https://sns-avatar-qc.xhscdn.com/avatar/6412ba1a00000000ff300cc2.jpg"
        },
        "metrics": {
          "likes": 8,
          "comments": 0,
          "shares": 0,
          "favorites": 2
        },
        "images": [
          "https://sns-webpic-qc.xhscdn.com/20261019/e38ec1fd03381eaef493!nd_dft_wlteh_webp_3"
        ],
        "mentions": [],
        "is_pinned": false
      },
      // … 19 more
    ]
  },
  "page": {
    "next_cursor": "c1.LwegQikqZdn9JGQkwTrpD-r4Bc3_yNoolTMdaIit",
    "cursor_expires_at": "2026-10-12T20:13:48.000Z",
    "has_more": true,
    "returned": 20
  },
  "warnings": [],
  "meta": {
    "capability": "xiaohongshu.users.notes.list",
    "result_status": "complete",
    "fetched_at": "2026-10-12T19:13:48.000Z",
    "cached": false,
    "replayed": false,
    "unavailable": {
      "url": "capability",
      "lang": "capability",
      "author.username": "capability",
      "author.verified": "capability",
      "author.followers": "capability",
      "metrics.views": "platform",
      "metrics.reposts": "platform",
      "hashtags": "capability",
      "mentions.username": "platform",
      "post_id": "platform",
      "parent_id": "platform",
      "root_id": "platform"
    },
    "billing": {
      "amount": "0.02",
      "currency": "USD",
      "balance_after": "9.98"
    }
  }
}
```

### Step 3: WeChat Official Account articles

Get the newest page of an Official Account's articles. `id` is the account's original ID (most start with gh_). With only a name, look the ID up once with `wechat.accounts.search` and keep it in the list of accounts. ([WeChat Official Account articles](https://dataxapi.com/apis/wechat_mp/accounts/articles/list/), $0.0200 / a call)

cURL

```bash
curl -G "https://api.dataxapi.com/v1/wechat_mp/accounts/articles/list" \
  --data-urlencode "id=gh_13c97ab93ce8" \
  -H "Authorization: Bearer $DATAXAPI_API_KEY"
```

Python

```python
# pip install dataxapi
from dataxapi import DataXAPI

dx = DataXAPI()  # reads DATAXAPI_API_KEY
result = dx.wechat_mp.accounts.articles.list(id="gh_13c97ab93ce8")
print(result["data"]["items"])
```

TypeScript

```typescript
// npm i @dataxapi/sdk
import { DataXAPI } from "@dataxapi/sdk";

const dx = new DataXAPI(); // reads DATAXAPI_API_KEY
const result = await dx.wechat_mp.accounts.articles.list({ id: "gh_13c97ab93ce8" });
console.log(result.data.items);
```

CLI

```bash
dataxapi call wechat_mp.accounts.articles.list id=gh_13c97ab93ce8
```

Recorded response: From a response recorded 2026-10-12 19:02 UTC. Names, text and IDs are examples, and so are the links: none is the recorded one (the page shows no one's personal data); the figures are as recorded. Long lists are cut. The request ID, cursor and balance are made up.

```jsonc
{
  "code": "ok",
  "request_id": "882b7d3d-9a50-48d1-ba28-513bec440e40",
  "data": {
    "items": [
      {
        "id": "2651350693_1",
        "url": "https://mp.weixin.qq.com/s/yEmemDFnwYkjLklz1HGeGz",
        "type": "article",
        "title": "实测一个月周末露营，结论有点意外",
        "text": null,
        "published_at": "2026-10-12T13:35:48.000Z",
        "author": { "id": "gh_baa95f56a86c" }
      },
      // … 9 more
    ]
  },
  "page": {
    "next_cursor": "c1.c3D9oI16A0J5E0SMD5JU_mAesJzXbexIUP2nOHbv",
    "cursor_expires_at": "2026-10-12T20:02:58.000Z",
    "has_more": true,
    "returned": 10
  },
  "warnings": [],
  "meta": {
    "capability": "wechat_mp.accounts.articles.list",
    "result_status": "complete",
    "fetched_at": "2026-10-12T19:02:58.000Z",
    "cached": false,
    "replayed": false,
    "unavailable": {
      "lang": "capability",
      "author.username": "capability",
      "author.name": "capability",
      "author.avatar_url": "capability",
      "author.verified": "capability",
      "author.followers": "capability",
      "metrics": "capability",
      "images": "capability",
      "hashtags": "platform",
      "mentions": "platform",
      "is_pinned": "capability",
      "post_id": "platform",
      "parent_id": "platform",
      "root_id": "platform"
    },
    "billing": {
      "amount": "0.02",
      "currency": "USD",
      "balance_after": "9.98"
    }
  }
}
```

## What the example costs

One refresh of one account on each of the three platforms, the newest page only; each extra account adds one call at its platform's price

| Endpoint | Calls | Price | Subtotal |
| --- | --- | --- | --- |
| [Douyin user videos](https://dataxapi.com/apis/douyin/users/videos/list/) | 1 | $0.0020 | $0.0020 |
| [Xiaohongshu user notes](https://dataxapi.com/apis/xiaohongshu/users/notes/list/) | 1 | $0.0200 | $0.0200 |
| [WeChat Official Account articles](https://dataxapi.com/apis/wechat_mp/accounts/articles/list/) | 1 | $0.0200 | $0.0200 |
| Total | 3 |  | $0.0420 |

Prices are the prices in force when this page was built. A failed call costs nothing.

## In your AI (MCP)

Connect DataXAPI to your AI client once. Then say what you want; the agent finds these endpoints, checks the price and calls them on your balance.

Say: Use DataXAPI to build me a dashboard: read the newest posts of the Douyin, Xiaohongshu and WeChat accounts I give you, keep each once by its ID in SQLite, and write a web page sorted by time posted and a CSV, with the new posts marked. Read the key from DATAXAPI_API_KEY, and first tell me what one refresh costs.

What the agent sends to the call tool: 

```json
{
  "capability": "douyin.users.videos.list",
  "id": "MS4wLjABAAAAZ0aPDJzFhBrs0q3wVsp2a9WWrBuAUMsVyygoaO0bCw8",
  "idempotency_key": "<a new UUID>"
}
```

[About the MCP server](https://dataxapi.com/mcp/)

## Why DataXAPI

- Steady: endpoints were available 100% of the last 30 days, on a public status page you can check.
- Fast: a paid call took 2.2 seconds at the median over the last 7 days (counted 2026-11-06).
- Fewer tokens: across 36 endpoints on Douyin, one recorded real response each, the platform's own JSON comes to 2.4M tokens and what an AI reads through DataXAPI's MCP server to 72k, 97% fewer; the JSON of a direct API call is 96% fewer too (counted 2026-11-06). Every platform answers in one shape: the author in `author`, counts in `metrics`, the next page in `page.next_cursor`, so another platform needs no new parser.
- See before you pay: every endpoint's page shows a recorded real response, field by field.
- Spending you control: a failed call is not charged; each key can have a limit, `X-Max-Price` caps one call, and the same `Idempotency-Key` within 24 hours is never charged twice.
- Ready for AI: a remote MCP server listed in the official MCP registry as `com.dataxapi/mcp`, usable from Claude, Cursor and ChatGPT.
- Free trial of up to 333 calls, no card.

## Good to know

- Use an AI that can run code on your computer, such as Claude Code or Codex. To run it yourself, save the script as `workbench.py`, install the SDK, set your key, run `python3 workbench.py`, then open `workbench.html`.
- To use your own accounts, change only `ACCOUNTS` near the top of the script, one a line. Call an account what you like, but leave the platform in the first column as it is once set: it is used to tell posts apart. For WeChat Channels add a line with `wechat_channels.users.videos.list` and the account ID that ends in `@finder`.
- A post is kept once, told apart by platform and ID; read again, only its likes and comments are brought up to date. An account that cannot be read is skipped, with the reason printed, and the others are kept. Run twice in a row on 2026-11-29, the first run marked all 89 posts NEW and the second none.
- The list of an Official Account's articles has no counts, so `likes` and `comments` are empty for them. For reads, likes and comments call `wechat_mp.articles.metrics` for each article, charged separately, and only for the new ones to spend no more than you need.
- Xiaohongshu's note list has no links, so `url` is empty for those posts. To open one, pass its `id` (the last column) to `xiaohongshu.notes.get`: the response has its link, and the call is charged separately.
- To refresh it every day, have the computer or a server run the script on a schedule: cron on a Mac or Linux, Task Scheduler on Windows. A scheduled job does not see a key you exported in a terminal, so give it there as well: in cron, `0 8 * * * DATAXAPI_API_KEY=dx_... /full/path/to/python3 /full/path/to/script.py` runs it at 8:00 every day (`which python3` prints Python's path); on Windows, add the key to your user environment variables. A refresh reads one page for each account, so a day costs that times its refreshes.
- Keep the key only in the environment of the machine that runs the script. The page it writes has no key in it and can be sent to a colleague; if the AI turns it into a site, the key stays on the server and never goes into the page's code.

## The whole script

The task above as one script that runs as it is: Python, the SDK, your key from DATAXAPI_API_KEY. It writes workbench.db, workbench.html and posts.csv, and ends by printing what it called, fetched and was charged.

```python
# pip install dataxapi
# export DATAXAPI_API_KEY=dx_...   (your key)
import csv
from decimal import Decimal
from dataxapi import DataXAPI

dx = DataXAPI()
calls, fetched, charged = 0, 0, Decimal("0")

def run(capability, params):
    """One call; counts it and what it was charged."""
    global calls, charged
    result = dx.call(capability, params)
    calls += 1
    charged += Decimal(str(result["meta"]["billing"]["amount"]))
    return result

import html
import os
import sqlite3
from datetime import datetime, timezone
from dataxapi import APIConnectionError, DataXAPIError

# The files are kept beside this script, wherever it is started from.
os.chdir(os.path.dirname(os.path.abspath(__file__)))

# 1. The accounts to follow: platform, any name you like, endpoint, account. Put your own here; each is one call a refresh.
ACCOUNTS = [
    ("Douyin", "Account A", "douyin.users.videos.list", {"id": "MS4wLjABAAAAZ0aPDJzFhBrs0q3wVsp2a9WWrBuAUMsVyygoaO0bCw8"}),
    ("Xiaohongshu", "Account B", "xiaohongshu.users.notes.list", {"id": "63bed214000000002702b862"}),
    ("WeChat", "Account C", "wechat_mp.accounts.articles.list", {"id": "gh_13c97ab93ce8"}),
]

# 2. Keep every post once, by platform and ID, with its latest counts. An account that fails is skipped; what the
#    others gave is kept.
db = sqlite3.connect("workbench.db")
db.execute("""create table if not exists posts (platform text, id text, account text, title text, url text,
    published_at text, likes integer, comments integer, first_seen text, primary key (platform, id))""")
now = datetime.now(timezone.utc).isoformat(timespec="seconds")
for platform, account, capability, params in ACCOUNTS:
    try:
        posts = run(capability, params)["data"]["items"]
    except (DataXAPIError, APIConnectionError) as error:
        print(f"skipped {account}: {error}")
        continue
    for post in posts:
        metrics = post.get("metrics") or {}
        db.execute("""insert into posts values (?, ?, ?, ?, ?, ?, ?, ?, ?) on conflict (platform, id) do update set
            likes = excluded.likes, comments = excluded.comments""",
            (platform, str(post.get("id") or post.get("url")), account, (post.get("title") or post.get("text") or "")[:80],
             post.get("url"), post.get("published_at"), metrics.get("likes"), metrics.get("comments"), now))
        fetched += 1
    db.commit()

# 3. A page for the browser and a CSV, newest first; the posts found for the first time are marked NEW.
COLUMNS = ["new", "platform", "account", "title", "url", "published_at", "likes", "comments", "id"]
rows = db.execute("""select case when first_seen = ? then 'NEW' else '' end, platform, account, title, url, published_at,
    likes, comments, id from posts order by published_at desc""", (now,)).fetchall()

def safe(value):
    """Text a spreadsheet would run as a formula is kept as text."""
    return f"'{value}" if isinstance(value, str) and value[:1] in ("=", "+", "-", "@", chr(9), chr(13)) else value

with open("posts.csv", "w", newline="", encoding="utf-8-sig") as file:
    csv.writer(file).writerows([COLUMNS, *([safe(value) for value in row] for row in rows)])

def cell(name, value):
    text = html.escape("" if value is None else str(value))
    is_link = name == "url" and text.startswith(("https://", "http://"))
    return f'<td><a href="{text}">open</a></td>' if is_link else f"<td>{text}</td>"

table = "".join("<tr>" + "".join(cell(name, value) for name, value in zip(COLUMNS, row)) + "</tr>" for row in rows)
with open("workbench.html", "w", encoding="utf-8") as file:
    file.write('<!doctype html><meta charset="utf-8"><title>Workbench</title>'
               "<style>body{font:14px system-ui;margin:24px}td,th{padding:6px 10px;border-bottom:1px solid #ddd;text-align:left}</style>"
               f"<h1>Workbench</h1><p>Refreshed {now}: {sum(row[0] == 'NEW' for row in rows)} new of {len(rows)}</p>"
               "<table><tr>" + "".join(f"<th>{name}</th>" for name in COLUMNS) + f"</tr>{table}</table>")

print(f"calls: {calls}, items: {fetched}, charged: ${charged}")
```

Run for real on 2026-11-29: 3 calls, 89 rows written, $0.0420 charged. A failed call is not charged.

## Endpoints

- [Douyin user videos](https://dataxapi.com/apis/douyin/users/videos/list/)
- [Xiaohongshu user notes](https://dataxapi.com/apis/xiaohongshu/users/notes/list/)
- [WeChat Official Account articles](https://dataxapi.com/apis/wechat_mp/accounts/articles/list/)

## More about Douyin

- [Douyin API](https://dataxapi.com/apis/douyin/)
- [Xiaohongshu (RedNote) API](https://dataxapi.com/apis/xiaohongshu/)
- [WeChat Official Accounts API](https://dataxapi.com/apis/wechat_mp/)
- [How to get Douyin keyword trends in bulk](https://dataxapi.com/guides/douyin-keyword-trends/)
- [How to export Douyin video comments in bulk](https://dataxapi.com/guides/douyin-video-comments/)
- [How to look up a Douyin creator's Xingtu rate card](https://dataxapi.com/guides/douyin-xingtu-creator-rates/)
- [Does Douyin have an API? Get videos and comments with Python (2026)](https://dataxapi.com/guides/douyin-api-python/)
- [How do I export Douyin data?](https://dataxapi.com/answers/export-douyin-data/)
- [What is sec_uid on Douyin, and how is it different from uid and the Douyin ID?](https://dataxapi.com/answers/douyin-sec-uid/)
- [What are aweme_id and modal_id on Douyin, and what is a v.douyin.com link?](https://dataxapi.com/answers/douyin-aweme-id-modal-id/)
- [Is the Douyin search index a number of searches?](https://dataxapi.com/answers/douyin-search-index-vs-search-count/)
- [What is the Douyin keyword index (Ocean Engine)?](https://dataxapi.com/answers/what-is-douyin-keyword-index-ocean-engine/)
- [What is Douyin Xingtu?](https://dataxapi.com/answers/what-is-douyin-xingtu/)
- [Douyin API for developers: third-party Douyin data APIs and what they return (2026)](https://dataxapi.com/answers/douyin-third-party-data-apis/)
- [Douyin video download URL: getting a video's play address by API (2026)](https://dataxapi.com/answers/douyin-video-play-url-api/)
- [Which social media data API is best for AI agents? Count the tokens a response takes (2026)](https://dataxapi.com/answers/social-media-api-for-ai-agents/)

---

Catalog revision ee799fed16791fcf. [HTML version](https://dataxapi.com/guides/social-media-workbench/)
