dsh-douyin-link-video: Convert Douyin Links to Video Files

Introduction

In agent development, fetching assets from external services is a common requirement. The traditional approach is either manually opening a browser to download, or relying on AI generation (which is unstable). If you could directly turn a link into a usable video file within the conversation flow, the toolchain would become more self-contained.

DSH (DeepSeek Harness) adopts an “everything is a plugin” architecture, where each plugin is an independent module. This article introduces a plugin that turns a “Douyin (TikTok China) link” into a “video file”: send a Douyin video link in a QQ chat, and the plugin automatically downloads the video (MP4) and sends it back to the same conversation as a QQ video message.

What It Is

dsh-douyin-link-video is a DSH plugin, categorized as a “Web Tool.” It is maintained by MaYuQiNB, with the core function of: detecting Douyin links in QQ conversations, downloading the corresponding video (MP4), and sending it back to the same conversation.

This plugin runs entirely locally, does not depend on external API keys, and only reuses the already-logged-in Douyin browser session and the QQ bot bridge.

Core Features

1. Automatic MP4 Download

  • Only downloads the video file (MP4) — no frame extraction, no transcription, no likes, no comments.
  • The video comes from play_addr.url_list[0] and is downloaded directly via Node fetch.
  • Processes at most 3 messages containing links per poll cycle to avoid flooding.

2. Local Execution, Reusing Existing Login State

  • QQ side: Connects to local SnowLuma (OneBot v11 HTTP), auto-discovering connection parameters from snowluma.httpUrl / accessToken in $DSH_HOME/qq-bridge/config.json.
  • Douyin side: Reuses the signed API of the locally logged-in dsh-douyin-scroll (Douyin browsing plugin) to avoid 403 errors caused by self-constructed signatures.
  • Runs entirely locally; access tokens are never written to state files or logs.

3. Supports Both Private Chats and Group Chats

  • Private chat: Binds to one conversation and only processes links sent by the other party in that conversation.
  • Group chat: owner_id is required; only processes links from that specific user to avoid triggering on other group messages.

4. Deduplication and Watermark

  • The same message will not be sent twice.
  • Plugin restarts will not re-send historical messages.
  • Deduplication is based on message_id|aweme_id, recorded in the recent field of $DSH_HOME/douyin-link-video/state.json.

Prerequisites

Before installing, ensure the following environment is ready:

Dependency Description
DSH >= 0.1.7-rc.1 (the plugin is in bundle form)
Node >= 18
QQ Bridge SnowLuma running locally (or any service compatible with OneBot v11 HTTP), with a working QQ bot account
Douyin Toolchain dsh-douyin-scroll (Douyin browsing plugin) installed and logged in locally. This plugin reuses its verified tools/cdp-fetch.mjs (fetches signed JSON within a logged-in headless page) and venv; a clear error is raised if not found

Installation & Activation

1. Install the Plugin

# Ensure these two plugins are installed and logged in
# - dsh-douyin-scroll (Douyin browsing): after installing, go to Settings → Douyin Browsing → Install main dependencies → Scan QR code to log in
# - This plugin
dsh plugin --profile desktop add link:/path/to/dsh-douyin-link-video

# 2) Restart DSH (bundle layer requires a restart to assemble)

After restarting, the tool douyin_link_video appears in the tool list of all Agents.

2. Bind a QQ Conversation (Private Chat)

{ "action": "bind", "qq_kind": "private", "qq_id": "3806242644", "label": "My main account" }

After binding, only links sent by the other party in this conversation will be processed.

3. Enable Auto-Polling

{ "action": "enable", "enabled": true }

The plugin reads the latest 30 messages from the bound conversation at each poll interval (configurable, with a default value), identifies Douyin links, and downloads them.

4. Test (Dry Run)

Does not actually send the video to QQ:

{ "action": "test", "url": "https://www.douyin.com/video/7707770041366954981", "dry": true }

Remove dry to actually send a video to the bound QQ conversation.

Group Chat Usage

Group chats require owner_id; only links from that specific user will be processed:

{ "action": "bind", "qq_kind": "group", "qq_id": "123456789", "owner_id": "3806242644" }

Other Actions

Action Description
status Enable state, binding, poll interval, sent/failed counts, whether QQ side and Douyin toolchain are ready
log Recent records (limit, default 10)
config Modify pollMs (8000–120000) / ownerId / onebotBaseUrl (usually no need to change, auto-discovered)

How It Works

┌─ QQ (SnowLuma / OneBot v11 HTTP)─────────────────────────┐
│  Reads the latest 30 messages from the bound conversation │
│  every pollMs cycle                                       │
│  Skips messages sent by the bot itself; in group chats,   │
│  only recognizes links from ownerId                       │
└───────────────────┬──────────────────────────────────────┘
                    │ douyin.com/video or v.douyin.com short link found in new messages
                    ▼
┌─ Douyin (reuses dsh-douyin-scroll)──────────────────────┐
│  cdp-fetch.mjs: fetches details with signature within a  │
│  logged-in headless page                                 │
│  → play_addr.url_list[0] (mp4 URL)                       │
│  → Node fetch with UA/Referer to download locally         │
└───────────────────┬──────────────────────────────────────┘
                    ▼
        send_private_msg / send_group_msg
        message: [{ type: 'video', data: { file } }]
        → You see the video directly in QQ

Security & Boundaries

  • Only reads QQ history and sends videos to the bound conversation; does not open other people’s conversations, modify profiles, or like/comment.
  • Only acts when a link is present: ordinary chat messages are completely ignored.
  • Deduplication: message_id|aweme_id is stored in recent; the same message is processed at most once.
  • No sensitive information is stored: the OneBot access token is read fresh from qq-bridge/config.json each cycle — never persisted to disk or written to logs.
  • Personal use positioning: Cookies / login state belong to you. Please comply with Douyin’s and QQ’s Terms of Service; account risks resulting from automated operations are borne by the user.

Known Limitations

  • Image-text posts (note) may not have play_addr; a clear “no downloadable URL available” error will be raised.
  • Depends on the login state of the “Douyin Browsing” plugin: if Douyin logs out, this plugin will also report an error. You’ll need to re-scan the QR code in the Douyin Browsing settings page.
  • When short link resolution fails (due to Douyin’s risk control), a failure log is recorded. You can try sending the full URL instead.
  • Only supports video messages; does not support live streams / collections / paywalled content played in the web player.
  • Processes at most 3 messages with links per cycle to avoid flooding.

Self-Check (Offline)

node selfcheck.mjs

No network access, no child processes spawned, no interaction with the real $DSH_HOME (uses a temp directory + injected fake fetch / fake home). Covers: state read/write and normalization, link detection and short link resolution, Douyin detail parsing, toolchain discovery, OneBot response normalization, and package contract static checks.

Use Cases & Notes

This plugin is suitable for scenarios where you need to directly obtain Douyin video assets within a conversation flow, such as:
- Automatically collecting shared video links
- Building a local video library (send to the bound conversation for subsequent processing)

Before use, please ensure:
- SnowLuma is running locally with OneBot v11 HTTP configured
- dsh-douyin-scroll is logged in with main dependencies installed
- You comply with Douyin’s and QQ’s Terms of Service to avoid account risks from automated operations

The plugin runs with the current DSH process privileges. It is recommended to review the source code and license (MIT) before installing.

Conclusion

This plugin demonstrates how to reuse an existing toolchain within the DSH ecosystem to turn external links into locally usable resources, making the agent toolchain more self-contained. Full information can be found on the plugin directory page and the GitHub repository.

Directory & Repository

  • Plugin Directory: https://www.skillhub.cn/plugins/MaYuQiNB/dsh-douyin-link-video
  • GitHub: https://github.com/MaYuQiNB/dsh-douyin-link-video
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye