Collect Short Video Data
Creator backends only show current cumulative values—there's no way to see what yesterday's numbers were. Saving a snapshot at the same time each day lets you calculate the daily increment and detect changes after any adjustments.
Collection uses playwright-cli to connect to a user's already-logged-in Chrome, opens the relevant tab to read the data loaded on the backend page, then closes it. It is read-only: no buttons are clicked, no settings are changed.
Preparation
- playwright-cli and its accompanying Chrome extension; Chrome must be logged into the platforms you want to collect. For scheduled collection, Chrome must be running and the computer must not sleep.
- Place a
video-data.jsonfile in the project root directory (followvideo-data.example.jsonas a template):
| Field | Default | Description |
|---|---|---|
time | "12:10" | Daily collection time, HH:MM, in the local timezone |
timezone | Local timezone | Determines which date's snapshot file is used |
platforms | Collect all three | Choose from douyin, weixin, xiaohongshu |
outDir | data/snapshots | Snapshot directory, relative to the project root |
Choose a time after content is published and consistent each day. Backend data for each platform has a delay; videos posted in the evening are more stable when collected around noon the next day.
Collection
Run from the project root directory (<skill> is the path to this skill's folder):
node <skill>/scripts/collect.mjs # Collect all platforms in config
node <skill>/scripts/collect.mjs douyin # Catch up only one platform
- Output is saved as
<outDir>/<date>.json. Re-running on the same day merges results: successfully collected data overwrites previous data for that platform, and failed platforms keep the existing snapshot from that day. - The file is written after each platform completes, so an interruption won't lose already-collected data.
- Exit code is 1 when a platform fails; the terminal shows which platform and what error.
not_logged_inmeans the login has expired—ask the user to re-login in Chrome. For other errors, manually retry once first; Douyin occasionally has temporary failures. - Do not run while the user has an unsaved form open in Chrome: the collection opens new tabs, which might steal focus from the form.
Scheduling
node <skill>/scripts/schedule.mjs prints a cron expression and a crontab line based on the time field. It only prints, does not modify the system setting. To change the time, update video-data.json and then recreate the scheduled task. Choose one of two options:
- Agent's built-in scheduler (recommended): Create a scheduled task using the printed cron expression, with a prompt like "Run the video-data collection in , retry failed platforms once, and report the number of works and followers for each platform." The agent can read errors and perform catch-up collections.
- System crontab: The user manually adds the printed line into
crontab -e. Logs are written tocollect.login the snapshot directory.
Before creating a scheduled task or modifying the crontab, show the time and command to the user first.
What's in the Snapshot
Each platform has a section: account (nickname, followers), works[] (each work includes id, desc, publishedAt, durationSec, metrics), and optionally error or warning. Ratios are decimals (0.55 means 55%).
| Platform | Extra Data | Limitations |
|---|---|---|
| Douyin | Traffic sources, chapter click rates, search terms, retention curves for works from the last 30 days (up to 12 works) | Work list reads at most 5 pages |
| Weixin | Daily trends for plays, likes, shares, and followers per account, broken down by source | Work list only reads the first page; writes a warning if there are more pages |
| Xiaohongshu | Impressions, cover click-through rate, 2-second skip rate, 5-second completion rate | Only collects video notes from the last 30 days (up to 12 works); no source analysis if views are under 100 |
Metrics with different definitions cannot be directly compared: Douyin and Xiaohongshu's early departure metric is "2-second skip rate," while Weixin's is "fast swipe rate" (fast_flip_rate).
Viewing Data
node <skill>/scripts/stats.mjs organizes all snapshots into a per-video table: daily plays, incremental plays, average play duration, completion rate, early departure rate, interactions, and follower growth, along with the latest traffic sources, search terms, and retention curves.
When the sample size is small, conclusions are marked as "insufficient sample." When comparing two videos, first compare the same number of hours after publication, then examine what changed.
What to Explain in the Delivery
- Which platforms were collected, how many works and followers for each, and which platform failed and why.
- The snapshot file path.
- For scheduling: the cron expression, the time zone for the trigger time, and which scheduling method is being used.