Skip to main content
Glama
Douyin Tools for DSH

Douyin Tools for DSH

by bxwyku
README.md
# 抖音工具包 · Douyin Tools for DSH

> 让 AI 帮你刷抖音:基于 CLI 让抖音成为 AI 随意调动的工具。
>
> Let AI do the scrolling for you: the official Douyin CLI, turned into tools your AI can call at will.

---

## 中文

### 这是个啥

一句话:**让 AI 帮你刷抖音——把抖音变成 AI 随手能调的工具。**

你平时刷抖音,看到有用的视频只能收藏起来,然后忘掉。这个插件让 AI 能直接读你账号里的东西——你收藏的视频、你的观看历史、某条视频的完整口播字幕、底下的评论。你不用再截图、不用再复制链接,直接问它"我上周收藏的那条讲 Codex 的视频说了什么",它自己去查。

它**不是爬虫,也不是破解工具**。它只是把抖音官方开放平台的命令行工具(`douyin-open-cli`)包了一层,变成 AI 能直接调用的 10 个工具。你扫码登录一次,它就只能看到**你本人授权的那个账号**,别的一概读不到。

### 装好之后 AI 能干什么

| 你说的话 | 它实际做的事 |
|---|---|
| "我收藏里有没有讲 XX 的视频" | 翻你的收藏列表,一条条看标题,告诉你有没有 |
| "我最近都在看什么" | 读你的观看历史,按时间排给你 |
| "这条视频到底讲了啥" | 拉官方语音识别出的完整字幕,直接总结 |
| "评论区在吵什么" | 读评论,按点赞排,挑出高赞的 |
| "帮我搜一下 codex 安装的教程" | 关键词搜索,返回标题、作者、点赞数、链接 |
| "这个人是谁" | 读你自己的账号资料(昵称、粉丝、作品数) |
| "这个分享链接是哪个视频" | 把短链解析成真实视频 |

一共 10 个工具,另外还留了一个"原样透传"的入口——官方 CLI 以后加了新功能,这个插件不用更新也能用。

### 怎么装

**第一步:装官方 CLI**(抖音开放平台提供的,装完是个 `douyin-open-cli` 命令)

Windows,在 PowerShell 里跑:

```powershell
powershell -NoProfile -ExecutionPolicy Bypass -File .\install.ps1 -AddToPath
```

macOS / Linux:

```bash
bash install.sh
```

(官方安装脚本的地址在抖音开放平台文档里,会随版本变化,所以这里不写死。)

**第二步:装这个插件**

在 DSH 的插件市场里搜 `douyin`,点安装;或者让你的 AI 执行:

```
install_bundle target=bxwyku/dsh-plugin-douyin
```

**第三步:扫码登录**

装好后跟 AI 说"帮我登录抖音",它会给你一张二维码。**用抖音 App 的"扫一扫"扫**,别用相册里的图片识别(抖音不接受相册里的登录码)。

### 几个要提前知道的事

- **登录有效期大约 6 小时**,不是一天。过期了 AI 会重新给你二维码,再扫一次就行。
- **只有扫码,没有账号密码登录**。官方就没提供密码登录这条路,插件也变不出来。
- **需要本机有 Python 3.9 或更高版本**(插件本身是个小 Python 程序,负责和官方 CLI 对话)。Windows 上装了 Python 一般就有。
- **数据不出你的电脑**。登录凭证加密存在本机(Windows 用系统级的 DPAPI 加密),工具只在你本机跑,不经过任何第三方服务器。
- **只能读你自己授权的账号**。想读别人的得他自己授权,这是平台的设计,绕不过去。

### 装不上怎么办

最常见的问题是插件启动了但找不到那个 Python 程序(因为每个人的安装路径不一样)。解决办法:打开插件目录下的 `cordis.patch.yml`,把 `args` 里那个 `./server.py` 换成完整路径,比如:

```yaml
args:
  - '-u'
  - 'C:/Users/你的用户名/AppData/Local/.../dsh-plugin-douyin/server.py'
```

改完重启 DSH 就好。

---

## English

### What this is

**AI does the scrolling — Douyin becomes a tool it can call.**

If you scroll Douyin, you save things and then forget them. This plugin lets the AI read your own account directly — your saved videos, your watch history, the full spoken transcript of a video, and the comments under it. No screenshots, no copy-pasting links. Just ask "what did that Codex video I saved last week actually say?" and it goes and looks.

It is **not** a scraper and **not** a cracking tool. It wraps Douyin's official open-platform CLI (`douyin-open-cli`) into ten tools the assistant can call. You log in once by scanning a QR code, and it can only ever see **the one account you authorized** — nothing else.

### What the assistant can do with it

| You say | It actually does |
|---|---|
| "Did I save anything about X?" | Walks your favorites, reads the titles, answers yes or no |
| "What have I been watching lately?" | Reads your watch history, newest first |
| "What is this video actually about?" | Pulls the official ASR transcript and summarizes it |
| "What are people arguing about down there?" | Reads comments, sorted by likes, picks the top ones |
| "Find me a tutorial on installing codex" | Keyword search: title, author, like count, link |
| "Who am I on here?" | Reads your own profile: nickname, followers, post count |
| "Which video is this share link?" | Resolves a short link into the real video |

Ten tools in total, plus a raw passthrough — when the official CLI adds features, this plugin keeps working without an update.

### Install

**1. Install the official CLI** (published by the Douyin open platform; gives you a `douyin-open-cli` command)

Windows, in PowerShell:

```powershell
powershell -NoProfile -ExecutionPolicy Bypass -File .\install.ps1 -AddToPath
```

macOS / Linux:

```bash
bash install.sh
```

(The script URLs live in the Douyin open-platform docs and change between versions, so they are not pinned here.)

**2. Install this plugin**

Search `douyin` in the DSH plugin market and click install, or have your assistant run:

```
install_bundle target=bxwyku/dsh-plugin-douyin
```

**3. Scan to log in**

Ask the assistant to log you in; it shows a QR code. Scan it with the **Douyin app's built-in scanner** — the "scan from photo library" path is refused for login codes.

### Things you should know first

- **A login lasts about six hours**, not a day. When it expires the assistant shows a new QR code.
- **QR only, no password login.** The official CLI has no password flow; this plugin cannot invent one.
- **You need Python 3.9+ on the machine** — the plugin is a small Python process that talks to the official CLI.
- **Your data stays on your computer.** Credentials are stored locally and encrypted (DPAPI on Windows). All calls run locally; no third-party server is involved.
- **Only your own authorized account.** Reading someone else's data would require their own authorization — that is how the platform is designed.

### If it will not start

The usual cause is the plugin starting but not finding its Python program, because install paths differ per machine. Open `cordis.patch.yml` in the plugin folder and replace `./server.py` in `args` with the full path:

```yaml
args:
  - '-u'
  - 'C:/Users/YOU/AppData/Local/.../dsh-plugin-douyin/server.py'
```

Restart DSH afterwards.

---

## What is inside / 目录结构

```
cordis.patch.yml   # 让 DSH 启动一个 MCP 服务(starts the MCP server)
server.py          # 10 个工具的薄封装(the ten tools, thin wrapper over the CLI)
docs/DETAIL.md     # 工具清单与返回字段(tool list and response fields)
locale/            # 市场卡片的中英文案(market card copy)
```

## Requirements / 依赖

- DSH `>=0.2.0-rc.0 <0.3.0`
- Python 3.9+
- `douyin-open-cli` 1.0.x(官方 CLI,需自行安装并扫码登录)

## License

MIT