# How do I get Douyin and Xiaohongshu data into a Coze or Dify workflow without cookies?

> Coze and Dify templates often scrape Douyin and Xiaohongshu with a pasted cookie that expires. Use a custom tool with one API key instead: endpoints, costs, a test call.

Canonical page: https://okdata.online/answers/coze-dify-douyin-xiaohongshu-data/

**Short answer: **Register okdata as a custom tool: Dify can import its OpenAPI schema with your key as a Bearer token, and Coze can create a plugin from the same HTTP endpoints with the key in a header. No cookie is involved; a Douyin account's latest videos cost $0.002 a page and a Xiaohongshu account's notes $0.02 a page.

The popular Coze workflow goes like this: paste the links of ten benchmark accounts (对标账号), collect their latest Douyin videos and Xiaohongshu notes into a Feishu table, then let the model rewrite the best ones. Step one of most tutorials says "copy your cookie from the browser and paste it here". It works for a few days. Then the cookie expires, the collection node returns nothing, and the workflow keeps "succeeding" with an empty table. Swapping that one node for an API call with a key fixes it for good.

## The endpoints the workflow needs

- [Douyin account profile](/apis/douyin/users/get/): takes a profile URL or a `v.douyin.com` share link and returns the account, including its sec_uid (starts with `MS4wLjABAAAA`). The list endpoint needs this ID, not the 抖音号 shown in the app.
- [Douyin account videos](/apis/douyin/users/videos/list/): newest videos with likes, comments and shares, about 20 a page.
- [Xiaohongshu account notes](/apis/xiaohongshu/users/notes/list/): newest notes, about 20 a page, by the ID in the profile URL.

Look up each Douyin sec_uid once and store it in the table; after that the daily run only calls the list endpoints.

## Registering the tool

- **Dify:** Tools → Custom → Create, import the schema from `https://okdata.online/openapi.json`, and set auth to API Key, header `Authorization`, type Bearer. Keep only the three or four operations you use, so the model does not pick the wrong one.
- **Coze:** create a plugin based on an existing service, base URL `https://api.okdata.online`, auth type Service with location Header, name `Authorization`, value `Bearer okd_...`. Add one tool per endpoint with `id`, `fields` and `cursor` as inputs.

Screen-by-screen steps for both are on the [integrations page](/integrations/).

## Cost of the benchmark-account workflow

| Run | Calls | Cost |
|---|---|---|
| One-time sec_uid lookup, 10 Douyin accounts | 10 | $0.02 |
| Daily: 10 Douyin + 10 Xiaohongshu accounts, first page | 20 | $0.22 |
| 30 days | 600 | $6.60 |

## Test the call first

```bash
curl -G "https://api.okdata.online/v1/douyin/users/videos/list" \
  -H "Authorization: Bearer $OKDATA_API_KEY" \
  -d id=MS4wLjABAAAA... \
  -d fields=id,url,text,published_at,metrics.likes,metrics.comments
```

When this returns videos, the plugin or custom tool will too.

## Gotchas

- Errors come back as JSON with `code` and `message` and are not charged. Add a branch for anything other than `ok`, so an empty table never looks like a quiet day.
- Douyin can pin older videos to the top of a profile; sort by `published_at` in a code node.
- Xiaohongshu hides view counts, so `metrics.views` is null.
- Recent Dify releases can also connect MCP servers. Whether yours can send a custom Authorization header depends on the version, so check before relying on it; the OpenAPI route works either way.
- The data is public posts only. Rewriting other people's content for your account is your call; copying it word for word is not a good one.

## Other ways

The Coze plugin store has Douyin and Xiaohongshu plugins; some are free and some ask for your cookie, which brings back the original problem. Feishu's own automation can pull from an HTTP endpoint too. For ten accounts checked once a week, a person with a spreadsheet is still a fine answer. All workflow tools are covered under [integrations](/integrations/).

## Endpoints used

- [Douyin account profile](https://okdata.online/apis/douyin/users/get/) `douyin.users.get`: $0.002 per call
- [Douyin account videos](https://okdata.online/apis/douyin/users/videos/list/) `douyin.users.videos.list`: $0.002 per call · about 20 videos per page
- [Xiaohongshu account notes](https://okdata.online/apis/xiaohongshu/users/notes/list/) `xiaohongshu.users.notes.list`: $0.02 per call · about 20 notes per page

Updated 2026-11-12
