dsh-douyin: Managing Douyin Favorites in a Browser via DSH

Introduction

When performing online or automated tasks in DeepSeek Harness (dsh), sites like Douyin (TikTok China), which have strict login requirements and heavy frontend rendering, are often difficult to resolve by simply “calling an API”: favorites lists are located on the webpage, batch operations must go through the official interface, and reverse-engineered APIs are neither stable nor should be touched. If you just want to organize favorites under your own account—login, categorize, and clean up by conditions—you usually have to open a browser locally and click manually.

dsh-douyin is a dsh plugin released by the maintainer youzishan6a (Category: Online Tools). It delegates three tasks to the Agent for the Douyin web version: scan code login, scrape and summarize favorites, and batch unfavorite by time. In terms of implementation, it only operates on the account logged in on your local machine, does not call reverse-engineered APIs, and does not forge signatures; everything is completed through the browser page. The plugin is open-source (MIT) on the GitHub repository youzishan6a/dsh-douyin; the current version in the documentation is 0.3.2; the community directory page is at youzishan6a/dsh-douyin on skillhub.cn. The DSH community plugin directory is an independent site and has no official affiliation with DeepSeek or Hanhua.

Below, we explain how to integrate it according to installation, usage, and boundaries.

What is this

dsh-douyin is targeted at developers already using dsh (recommended >= 0.2.1, README verified on 0.2.2-rc.1) who have Chrome or Edge locally. The plugin exposes a set of tools to the Agent (such as douyin_login, douyin_favorites_scan, etc.), which are called by dsh based on the conversation intent; data and login state are stored locally in ~/.dsh/douyin/ and are not uploaded to third-party servers.

Environment Requirements

Before installation, you should read the repository source code and the MIT license, and confirm that you are willing to launch a browser locally with current dsh process user permissions to access douyin.com. The plugin uses these permissions to read and write local state files (including sensitive cookies).

  1. dsh >= 0.2.1
  2. Node.js >= 20.11
  3. Local Chrome or Edge (uses system browser by default)
  4. pnpm (required by dsh plugin): npm i -g pnpm

Installation and Enablement

First, install pnpm globally, then execute the installation command from the documentation:

npm i -g pnpm
dsh plugin --profile web add github:youzishan6a/dsh-douyin

Then add the plugin to the profile’s bundle list. Edit ~/.dsh/profiles/web/package.json, adding dsh-douyin to both dependencies and dsh.profile.bundles (see the complete example in the repository README).

After saving, restart dsh and check if it loaded:

dsh --profile web --dump-config | grep douyin

Seeing a dsh-douyin entry indicates successful loading.

Method 2: Manual Mount

If the bundle is not effective, you can append the insert entry for dsh-douyin to the end of ~/.dsh/profiles/web/cordis.patch.yml. The two methods are equivalent, so do not repeat IDs.

After installation, restart dsh; asking “What tools does the Douyin plugin have” or simply saying “Help me log in to Douyin” in the conversation will trigger it.

Core Functions

Scan Code Login

Calling douyin_login will pop up a local browser window displaying the Douyin login QR code. After scanning, the login state is written to ~/.dsh/douyin/state.json. You can use force to switch accounts and timeoutSeconds to control the wait time.

Favorites Summarization

  1. douyin_favorites_scan: Scrolling and scraping the favorites page, writing to a local ledger; up to 150 new entries per batch, continuous calls allow for continuing batches.
  2. douyin_favorites_summarize: Filters by type (e.g., 美食 (Food), tech) or natural language exclude, returning structured material suitable for writing a summary.

types supports category IDs, Chinese names, or keywords; exclude can be a sentence of natural language, which the plugin will split into words to exclude.

Unfavorite by Time

douyin_unfavorite_old filters favorites by “how many days ago” and proceeds through Douyin’s built-in batch management process to unfavorite them. By default dryRun=true only lists the items; after confirmation, you need dryRun=false and confirm=true for execution.

The Douyin web version does not provide favorite time, so ageBasis has two approximations:

ageBasis Meaning
publish (default) Video publish time
firstSeen The time the plugin first scanned this favorite entry

If publish time is missing, the plugin will open the details page to supplement it (limited by enrichLimit); those that cannot be supplemented are classified as “time unknown” and skipped to avoid accidental deletion.

Typical Usage

First login:

You: Help me log in to Douyin
Agent: Calls douyin_login → Browser window pops up showing QR code
You: Scan with Douyin App
Agent: Login successful, login state saved to ~/.dsh/douyin/state.json

Summarize food category favorites:

You: See what I've recently favorited and summarize the food category
Agent: douyin_favorites_scan → douyin_favorites_summarize(types=["美食"])

Unfavorite old favorites after a dry run:

You: Unfavorite the promotional videos I favorited a year ago that I no longer want to see
Agent: douyin_unfavorite_old(olderThanDays=365, exclude="带货", dryRun=true)
You: Confirm, execute
Agent: douyin_unfavorite_old(..., dryRun=false, confirm=true)

Other common tools: douyin_status (login state and ledger size; real validation when probe=true), douyin_check_update (check GitHub for new version, install when apply=true). There is also a “Douyin Favorites” page and a “Check Update” button in the Web client settings.

Security and Data

Unfavoriting is irreversible. The plugin defaults to dry-run mode; for actual execution, allowDestructive must be enabled, the number of items must not exceed maxUnfavoritePerRun, and only the matching items should be selected, not all. Sensitive files include state.json (cookies, permission 600) and ledger.json; do not commit or share them.

You can adjust dataDir, browserChannel, headless, allowDestructive, maxUnfavoritePerRun, etc., in the plugin config of cordis.patch.yml (see README for default values and field descriptions).

Applicable Scenarios and Notes

Suitable for: Organizing personal account favorites, letting the Agent in dsh conversation scan and summarize in batches, and cleaning up long-unused favorites in small batches.

Not suitable or things to be aware of:

  • Desktop/remote pure headless environments (default is headed; headless is easily blocked by CAPTCHA).
  • Page redesigns may cause selectors to fail; login state usually expires after a few weeks and requires re-douyin_login.
  • Automated operations may conflict with the platform’s Terms of Service; account risks are borne by the user; it is recommended to control frequency and keep the batch size under 20–30 items as suggested in the README.
  • The plugin does not provide the ability to bypass risk control, CAPTCHA, or login protection.

To uninstall, use dsh plugin --profile web remove dsh-douyin, remove the entry from the bundle or patch, and delete ~/.dsh/douyin/ as needed.

Conclusion

dsh-douyin encapsulates Douyin web version login and favorite management into dsh tools, suitable for the “local browser + Agent orchestration” approach. For more parameters, batch scan rules, and development notes, see the repository README.

羽毛球分组比赛记分
小程序二维码

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

Xiaoye