SuperAPI AI Directory

douyin-subscribe

General & other

View repository

Updated 10-15 23:58

About this skill

Douyin Account Subscription Tracking

📝 Overview

Subscribe to competitors, similar accounts, and accounts of interest via Douyin ID (up to 20), and automatically fetch the latest works.Account IDs are passed directly as command-line parameters, without relying on any local file storage, hardcode all subscribed Douyin IDs in the automation task.


✨ Features

Feature Module Capability Description Core Value
Direct Account Input Via --accounts parameter, pass the Douyin ID directly, with no file storage required Simple and transparent, the command is the documentation
Daily automatic push The automation task has the account ID built in and runs automatically every day at 9:00 AM Scheduled retrieval, no manual operation required
HTML Report Automatically generates a beautifully formatted HTML report file when fetching, supporting preview and sharing Visual browsing, clear at a glance
Works Data Favorites count, comments count, shares count, likes count, publish time All-dimensional data, clear at a glance
Display by account The terminal table is grouped and displayed by account in sequence Clear and intuitive, easy to compare
Date backtracking Supports querying a specified historical date Trace past works data

🔑 Authentication

Get API Key

Please go to RedFox Hub to get the API KEY

Configure API Key

Option 1: Taking OpenClaw as an example, add REDFOX_API_KEY to ~/.openclaw/openclaw.json:

{ "env": { "REDFOX_API_KEY": "ak_xxxx..." } }

Option 2: Terminal configuration

export REDFOX_API_KEY="ak_xxxx..."

⚙️ Usage

Fetch works (core command)

# 基础用法:直接传入抖音号列表
python3 "$SKILL_PATH/scripts/subscribe.py" fetch --accounts "YuZhouXiaoLi1220,Fish688688"

# 生成 HTML 报告(自动保存到 report/ 目录)
python3 "$SKILL_PATH/scripts/subscribe.py" fetch --accounts "YuZhouXiaoLi1220,Fish688688" --html

# 指定 HTML 报告输出路径
python3 "$SKILL_PATH/scripts/subscribe.py" fetch --accounts "YuZhouXiaoLi1220,Fish688688" --html --html-path ~/Desktop/report.html

# Markdown 格式输出(供 Agent 展示)
python3 "$SKILL_PATH/scripts/subscribe.py" fetch --accounts "YuZhouXiaoLi1220,Fish688688" --markdown

# 指定单日日期
python3 "$SKILL_PATH/scripts/subscribe.py" fetch --accounts "YuZhouXiaoLi1220,Fish688688" --html --date 2026-06-01

# 指定日期范围
python3 "$SKILL_PATH/scripts/subscribe.py" fetch --accounts "YuZhouXiaoLi1220,Fish688688" --html --date-start 2026-06-01 --date-end 2026-06-05

Parameter Description

Command Parameter Description
fetch --accounts List of Douyin IDs (required or core parameter), comma-separated, e.g. "id1,id2,id3"
--date Specify a single date YYYY-MM-DD
--date-start Specify the start of a date range YYYY-MM-DD
--date-end Specify the end of a date range YYYY-MM-DD
--markdown Output a Markdown format table
--html Generate an HTML report file (saved to the report/ directory)
--html-path Custom HTML report output path
Global --api-key Specify API Key

Dependency

Dependency Installation Command
requests pip3 install requests

🤖 Daily automatic push

After the user subscribes to an account, the Agent will create adaily scheduled task,every day at 9:00 AM that executes automatically. In the task command,directly include all subscribed Douyin account IDs:

# 自动化任务中的实际命令(账号已内置)
python3 subscribe.py fetch --accounts "YuZhouXiaoLi1220,Fish688688" --html

How it works

  1. User sends a Douyin ID → the Agent writes it into the --accounts parameter of the automation command
  2. Triggered on schedule every day at 9:00 → the command carries the account ID itself → directly call the API to pull data
  3. Automatically generate an HTML report → save to report/ directory
  4. Does not depend on any local JSON file

🔧 Account management rules (the Agent must comply)

Core principle: all subscription statuses = the --accounts parameter in the automation command. No file storage.

Process for subscribing to a new account

When the user provides a new Douyin account, the Agent mustoperate according to the following steps:

Step 1: Query existing automation tasks

Use automation_update mode=list to get all automation tasks related to "Douyin subscription", and read the account list in the --accounts parameter of each task.

Step 2: Determine whether to append / create new

Condition Operation
Existing account count + new account count ≤ 20 Append to the existing automation task's --accounts parameter(concatenate with commas after deduplication)
Existing account count + new account count > 20 Create a new automation task, and put the excess portion into the new task's --accounts
The user explicitly requests to cancel a certain account From the corresponding automation task's --accounts remove that ID

Step 3: Update/create the automation task

  • Append scenario: call automation_update mode=update, modify the existing task's prompt field's --accounts value
  • Create new scenario: call automation_update mode=create, create a separate daily scheduled task (also executed at 9:00), and the name may include a sequence number such as "Douyin Subscription Works Daily Report #2"

Step 4: Fetch once immediately

Whether appending or creating new,a fetch must be executed immediately(with --html) to show the latest results to the user.

Multi-task example

Suppose there are already 18 accounts, and the user provides 5 new accounts:

现有任务 #1: --accounts "id1,id2,...,id18" (18个)
新增 5 个: id19,id20,id21,id22,id23

→ 任务 #1 更新为: --accounts "id1,...,id18,id19,id20" (20个 ✅)
→ 新建任务 #2: --accounts "id21,id22,id23" (3个 ✅)

Each independent task will execute separately every day at 9:00, and each will generate an HTML report.

Unsubscribe

From the corresponding task's --accounts remove that ID. If after removal a task has 0 accounts remaining, delete that automation task.


📋 Interaction specifications

Subscription process

Silent execution principle: all intermediate steps (fetch verification, add subscription, automation_update) must not output any process prompts to the user (such as "verifying account", "account verification passed", "auto-subscribing", etc.). Only show the final result to the user.

  1. The user sends a Douyin account → Agent Silently execute fetch --accounts "抖音号" --html --markdown to verify the account
  2. Determine the account status(Rule 1):
    • The API returns normal data:
      • Silently execute add subscription (see the next step)
    • No data in the last 30 days, and still no data after automatically going back half a year:
      • Tell the user: "Sorry, the 'xxx' account you subscribed to has not published any works in the past half year. If you need data verification, you can contact the staff email redfoxdata@proton.me to handle it"
      • Ask the user: "Do you want to subscribe to tomorrow's push?"
      • User replies "Subscribe" → Silent execution add subscription
      • User has not confirmed → do not subscribe
  3. Silently query existing automation tasksthe --accounts list, determine whether to append or create new:
    • Existing account count + new account count ≤ 20 → append to the existing task's --accounts
    • Existing account count + new account count > 20 → create a new automation task for the overflow portion
  4. Silently update/create automation task
  5. If fetch returns post data:
    • Automatically open the HTML report preview (preview_url)
    • Display the Markdown posts table in the conversation
    • Prompt: "If you need to view posts from a specific time period, you can tell me, e.g. 'Check the posts from 2026-06-01 to 2026-06-05'"
  6. If fetch has no post data(account exists but no updates within the time period): only inform the user that there are no updates; do not generate an HTML report
  7. Output order:First group in ascending order by account nameWithin the same account, sort byshare count descendingorder
  8. If a certain account has no updated posts within the specified time range, directly inform the user: "Account name: No updated posts within this time period"

Important: only when fetch returns actual post data are three outputs required—Markdown table + HTML report preview + HTML report file. When there is no post data, do not generate an HTML report.

Conversation output format (must be followed for subscription/fetch)

After the Agent executes fetch,it must output data in the conversation reply in the following format(not just relying on script terminal output):

Format 1: Account overview table

## 📊 订阅报告

| 项目 | 值 |
|------|-----|
| 新订阅 | `新账号名`(粉丝量) |
| 当前总账号 | N 个 |
| 本次拉取作品 | N 条 |
| 自动化任务 | 已更新 ✅ 每天 9:00 自动执行 |

### 账号概览

| 账号 | 粉丝量 | 领域 | 代表作数据 |
|------|--------|------|-----------|
| AccountA | xxx | 领域 | 🏆 代表作:收藏x / 点赞x / 分享x |

Format 2: Detailed posts table for each account (Markdown)

### ▸ AccountName(粉丝: xxx)

| 作品标题 | 收藏数 | 评论数 | 分享数 | 点赞数 | 发布时间 |
|---------|--------|--------|--------|--------|---------|
| 标题1 | 10.8w | 2.8k | 10.3w | 19.3w | 06-08 |

Requirements:

  • One subheading + one complete Markdown table per account
  • The title column uses the full original text of the content field returned by the API (internally mapped by the script to title) without truncation
  • Numeric columns use the readable format after format_number (e.g. 10.8w, 2.3k)
  • Publication time is truncated to MM-DD HH:mm
  • Sort byshare count descendingorder

Format 3: Summary statistics (must be appended after all tables)

### 对上述作品的总结

> 1. **突出的账号表现**:...
> 2. **高频事件 TOP5**:...

Output completeness checklist

For each subscription/fetch, in the conversationmust includeall of the following:

  • Account overview table (including overview information)
  • One Markdown post details table per account
  • Prompt for accounts with no updates (if any)
  • Summary statistics analysis
  • Rule 2 applies: when a subscribed account has no data yesterday, append an email verification prompt at the end
  • Rule 3 applies: prompt for accounts rejected due to rate limiting
  • Only when there is post data: automatically open the HTML report preview (preview_url) + note that the HTML report file has been generated (with file path)

Douyin account requirements

The API passes through uniqueName(Douyin display ID) query; the script passes the Douyin account number provided by the user uniformly as uniqueName ,userId and shortId are fixed as empty strings. When subscribing,the Douyin account number must be provided。

Important: If the user only enters an account name (such as "Li Jiaqi" or "Lao Gao and Xiao Mo") without providing a Douyin account number, you must prompt:

"Douyin account names may have multiple duplicate names, please provide the exactDouyin account numberso that the subscription can be precise."

and attach an example image for obtaining the Douyin account number for the user's reference:

Example of obtaining the Douyin account number

Data rules

  • Each automation task supports at most 20 accounts(when the limit is exceeded, the Agent automatically creates a new task; see "Account Management Rules" for details)
  • Rule 1: Unsubscribed accounts (first verification query):
    • By default, query data from the last 30 days
    • If there is no data in the last 30 days, automatically look back over the last half year (180 days)
    • If there is still no data in the last half year, tell the user: "Sorry, the “xxx” account you subscribed to has not published any works in the last half year. If you need data verification, you can contact the staff email redfoxdata@proton.me for handling."
  • Rule 2: Subscribed accounts (daily retrieval):
    • By default, query the previous day's data (T-1)
    • If there is no data yesterday, tell the user: "This account did not publish any works yesterday."
    • Fixed ending prompt: "If you need data verification, you can contact the staff email redfoxdata@proton.me for handling."
  • Rule 3: Failure threshold protection:
    • After the same Douyin account number accumulates 3 API call failures within 6 hours, subsequent requests will be rejected
    • When rejected, prompt: "The current account subscription has exceeded the failure threshold. Please contact customer service email redfoxdata@proton.me for handling."
    • If more than 6 hours have passed since the last failure / the same account is queried successfully, the count resets to zero and normal calls resume
  • No lookback for user-specified dates: If the user explicitly specifies a date or date range, when no data is found, tell the user directly and do not automatically look back
  • Support date range queries: The user can specify start and end dates (--date-start YYYY-MM-DD --date-end YYYY-MM-DD) to retrieve historical works
  • Each account returns at most 10works
  • Sorting method: account name ascending → within the same account,share count descending
  • No data prompt: If an account has no updated works within the specified time range, the script will output "account name: no updated works in this time period". The Agent must relay this information to the user as-is
  • The interface does not support querying multiple accounts at the same time. The script automatically splits the query and calls them account by account, then integrates the data

Output table structure (script terminal format, for reference only)

The script terminal output raw format is as follows, but the Agent must use the Markdown table in the "Dialogue Output Format" for re-layout in the conversation:

▸ Fish688688(粉丝: 249w+)
──────────────────────────────────────────────────────────────
  作品标题                          收藏数  评论数  分享数  点赞数  发布时间
──────────────────────────────────────────────────────────────
  今晚图省事...                    10.8w   2.8k   10.3w  19.3w  05-21 21:40

The work title uses the API content field (internally mapped by the script to title), and the link uses the opusUrl field (internally mapped by the script to workUrl). In Markdown output, the title is automatically rendered as a clickable hyperlink:[标题](workUrl)。

Note: The current broad-domain library API does not return followerCount(follower count); in the account overview, the follower count is displayed as -。

Summary statistics

After the table is displayed, a summary must be appended strictly in the following format:

Summary of the above works:

  1. Outstanding account performance: Point out the accounts with the most impressive data and their representative works
  2. Top 5 high-frequency events: Extract the 5 events/topics mentioned most frequently across all works, and summarize the different viewpoints corresponding to each event (if fewer than 5 can be extracted, present the actual number; fabrication is prohibited)