API Reference
Complete REST API endpoint documentation
The dokobot-intel-toolkit exposes its pipeline as a set of CLI-driven stages that you invoke sequentially. Each stage corresponds to a discrete REST-style operation: readiness check, scrape, parse, compare, and report. Use this reference to understand the exact shape of each command invocation, the parameters it accepts, what it returns on success, and how it signals errors — so you can integrate the toolkit into your own automation scripts or CI pipelines.
dokobot_ready.py
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) | — | — | This script takes no parameters. It reads the bridge state from the running dokobot CLI and prints result to stdout. |
PowerShell Scraping Scripts
Each platform scraping script shares a common parameter surface:
| Parameter | Type | Required | Description |
|---|---|---|---|
-Platform | string | Yes | Target platform identifier. Accepted values: x, v2ex, producthunt, indiehackers, xiaohongshu, bilibili, youtube. Additional platforms are supported; refer to the specific script for the full list. |
-OutputDir | string | Yes | Path to the directory where raw output files will be written. |
-DeviceId | string | Yes | The DEVICE_ID value returned by dokobot_ready.py. Required for authenticated scraping through the Edge bridge. |
-RateLimit | integer | No | Milliseconds to wait between requests. Defaults to a safe platform-specific value when omitted. |
Python Parse & Clean Scripts
| Parameter | Type | Required | Description |
|---|---|---|---|
--input-dir | string | Yes | Path to the directory containing raw scrape output files produced by the scraping stage. |
--output-dir | string | Yes | Path where cleaned, structured output files will be written. |
--encoding | string | No | Force a specific input encoding (e.g., utf-8, gbk). Defaults to automatic detection. |
Incremental Comparison Scripts
| Parameter | Type | Required | Description |
|---|---|---|---|
--today | string | Yes | Path to today's cleaned data directory. |
--baseline | string | Yes | Path to yesterday's saved baseline directory. |
--output | string | Yes | Path where the annotated diff output file will be written. |
Summary & Report Generation Scripts
| Parameter | Type | Required | Description |
|---|---|---|---|
--diff-dir | string | Yes | Path to the incremental comparison output produced in the previous stage. |
--output | string | Yes | File path for the final intelligence report. |
--format | string | No | Output format. Accepted values: markdown, json. Defaults to markdown. |
WorkBuddy Skills (bili-subtitle, deck-studio, xhs-commercial-growth)
Skills are activated inside the WorkBuddy application and are not invoked via CLI parameters in the same way. See the Notes section for activation details.
| Field | Type | Required | Description |
|---|---|---|---|
skill_name | string | Yes | The exact skill package name: bili-subtitle, deck-studio, or xhs-commercial-growth. |
input (bili-subtitle) | string | Yes | A Bilibili video BV number (e.g., BV1xx411c7mD). |
input (deck-studio) | string | Yes | A plain-text topic brief describing the slide deck subject. |
input (xhs-commercial-growth) | string | Yes | A trending topic or content idea to evaluate for Xiaohongshu monetization potential. |
dokobot_ready.py
Prints one of two lines to stdout:
DEVICE_ID:<uuid>— The Edge bridge is active. The<uuid>portion is your device ID; pass it as-DeviceIdto all scraping scripts.NO_DEVICE— The Edge bridge extension is not active. You must open Microsoft Edge and activate the bridge before proceeding.
Exit code is 0 in both cases; the printed value, not the exit code, is the authoritative readiness signal.
PowerShell Scraping Scripts
Writes one or more raw output files to the specified -OutputDir. File names are platform-prefixed (e.g., x_raw.json, bilibili_raw.json). Returns exit code 0 on success.
Python Parse & Clean Scripts
Writes cleaned, structured files to --output-dir. Each file contains an array of records with the fields title, popularity_score, and url. Returns exit code 0 on success.
Incremental Comparison Scripts
Writes an annotated diff file to --output. Topics that are newly trending since the baseline are marked with a 🆕 emoji. Returns exit code 0 on success.
Summary & Report Generation Scripts
Writes a single structured intelligence report to --output. The report aggregates monetization signals across all platforms and highlights the strongest opportunities for Xiaohongshu content repurposing. Returns exit code 0 on success.
WorkBuddy Skills
- bili-subtitle: Returns a full transcript string for the given BV number. If an official subtitle track exists, it is used directly. If not,
faster-whisperlocal speech recognition is used as a fallback (requiresfaster-whisperto be installed). - deck-studio: Returns a complete slide deck outline including slide titles, content drafts, and visual descriptions, derived from your topic brief.
- xhs-commercial-growth: Returns a structured evaluation of the input topic against the three-currency (attention, trust, purchase intent), two-system (virality and monetization) framework, including a commercial-distance assessment.
dokobot_ready.py
| Error | When it occurs |
|---|---|
NO_DEVICE (stdout, not an exception) | The dokobot Edge bridge extension is not running in Microsoft Edge. Open Edge and activate the bridge extension to resolve. |
| Script crash / non-zero exit | The dokobot CLI process is not running or is unreachable. Ensure the dokobot CLI is started before invoking this script. |
PowerShell Scraping Scripts
| Error | When it occurs |
|---|---|
AuthenticationError | The -DeviceId is stale or the Edge bridge session has expired. Re-run dokobot_ready.py to obtain a fresh device ID. |
RateLimitExceeded | The target platform has throttled requests. Increase -RateLimit or wait before retrying. |
PlatformUnavailable | The target platform is unreachable (network error or platform outage). |
InvalidPlatform | The value passed to -Platform is not a recognized identifier. |
Python Parse & Clean Scripts
| Error | When it occurs |
|---|---|
FileNotFoundError | The --input-dir path does not exist or contains no raw files from the scraping stage. |
EncodingError | A raw file cannot be decoded with the detected or specified encoding. Specify --encoding explicitly to override. |
Incremental Comparison Scripts
| Error | When it occurs |
|---|---|
BaselineNotFound | The --baseline path does not exist. This typically happens on the first run when no previous day's data is available. Seed an empty baseline directory to allow the script to proceed. |
SchemaMismatch | The structure of today's cleaned data differs from the baseline (e.g., after a parse script update). Re-run the parse stage on both directories with the same script version. |
Summary & Report Generation Scripts
| Error | When it occurs |
|---|---|
EmptyDiffError | The --diff-dir contains no comparison output. Ensure the incremental comparison stage completed successfully before running this script. |
UnsupportedFormat | An unrecognized value was passed to --format. Use markdown or json. |
WorkBuddy Skills
| Error | When it occurs |
|---|---|
SkillNotFound | The named skill package is not present in ~/.workbuddy/skills/. Enable the skill inside the WorkBuddy application before invoking it. |
InvalidBVNumber (bili-subtitle) | The BV number supplied does not match a valid Bilibili video identifier format. |
SubtitleUnavailable + faster-whisper not installed (bili-subtitle) | The video has no subtitle track and faster-whisper is not installed. Install faster-whisper to enable the speech-recognition fallback. |
EmptyBrief (deck-studio) | The topic brief passed to deck-studio is empty or too short for the agent to generate a meaningful outline. |
1. Check bridge readiness
Before any scraping, confirm the Edge bridge is active and capture your device ID.
python dokobot_ready.py
Expected output (bridge active):
DEVICE_ID:3f7a1c2e-84b0-4d9e-bc12-0a5e9f3d6781
Expected output (bridge inactive):
NO_DEVICE
If you see NO_DEVICE, open Microsoft Edge, activate the dokobot bridge extension, and re-run the script.
2. Scrape X (Twitter) with authenticated bridge
Once you have a valid device ID, run the X scraping script:
.\scrape_platform.ps1 `
-Platform x `
-OutputDir .\raw_output `
-DeviceId 3f7a1c2e-84b0-4d9e-bc12-0a5e9f3d6781 `
-RateLimit 2000
Expected output:
[INFO] Scraping platform: x
[INFO] Bridge device: 3f7a1c2e-84b0-4d9e-bc12-0a5e9f3d6781
[INFO] Writing raw output to: .\raw_output\x_raw.json
[OK] Scrape complete. 47 items captured.
3. Parse and clean raw scrape data
python parse_clean.py \
--input-dir ./raw_output \
--output-dir ./cleaned_output
Expected output:
[INFO] Processing x_raw.json ... 47 records → 44 after dedup/clean
[INFO] Processing bilibili_raw.json ... 31 records → 31 after dedup/clean
[OK] Cleaned data written to ./cleaned_output
4. Run incremental comparison against yesterday's baseline
python compare_incremental.py \
--today ./cleaned_output \
--baseline ./baseline_yesterday \
--output ./diff_output/today_diff.json
Expected output (excerpt from today_diff.json):
[
{ "title": "GPT-5 benchmark leak", "platform": "x", "popularity_score": 9840, "url": "https://x.com/...", "new": true },
{ "title": "Open-source LLM hits 100k GitHub stars", "platform": "reddit", "popularity_score": 7210, "url": "https://reddit.com/...", "new": true }
]
Newly trending topics are flagged with "new": true and marked 🆕 in Markdown report output.
5. Generate the daily intelligence report
python generate_report.py \
--diff-dir ./diff_output \
--output ./reports/intel_2024-06-15.md \
--format markdown
Expected output (file excerpt):
# Daily Intelligence Report — 2024-06-15
## Top Monetization Signals
🆕 **GPT-5 benchmark leak** (X/Twitter) — Score: 9840
URL: https://x.com/...
🆕 **Open-source LLM hits 100k GitHub stars** (Reddit) — Score: 7210
URL: https://reddit.com/...
6. Enable and use the bili-subtitle Skill
First, enable the skill inside WorkBuddy. Then invoke it with a BV number:
# Inside WorkBuddy application
skill: bili-subtitle
input: BV1xx411c7mD
Expected output:
[Transcript]
00:00 — Welcome to this tutorial on building AI agents...
00:14 — Today we'll cover three core patterns...
...
[Source: official subtitle track]
If no subtitle track is available and faster-whisper is installed, the output will indicate [Source: faster-whisper ASR].
7. Use the xhs-commercial-growth Skill to evaluate a signal
# Inside WorkBuddy application
skill: xhs-commercial-growth
input: "AI coding assistants replacing junior developers"
Expected output (excerpt):
Topic: AI coding assistants replacing junior developers
Currency Analysis:
Attention score: High — strong emotional hook
Trust score: Medium — requires credibility anchoring
Purchase intent score: High — direct link to upskilling products
Commercial distance: Short — monetizable within 1–2 content pieces
Recommended system: Virality-first, then monetization funnel
Bridge must be active before any scraping. All PowerShell scraping scripts require a valid DEVICE_ID from dokobot_ready.py. If the Edge bridge goes inactive mid-run (for example, if Edge is closed), subsequent scrape calls will fail with AuthenticationError. Re-run dokobot_ready.py to verify bridge state before retrying.
NO_DEVICE is not an error code — it is informational output. The exit code of dokobot_ready.py is always 0. Your automation scripts must inspect the printed string, not the exit code, to determine bridge readiness.
First run has no baseline. The incremental comparison script requires a --baseline directory from the previous day. On your very first run, no baseline exists. Create an empty directory and pass it as --baseline to allow the script to treat all topics as newly trending (all items will be marked 🆕).
Platform coverage. The scraping scripts cover X, V2EX, Product Hunt, IndieHackers, Xiaohongshu, Bilibili, YouTube, and additional platforms. Not all platforms require the Edge bridge — only those behind login walls (such as X and Reddit) use authenticated scraping. Platforms that allow anonymous access are scraped directly.
WorkBuddy Skills are installed at ~/.workbuddy/skills/. You must activate each Skill inside the WorkBuddy application before it can be invoked. The three available Skills are bili-subtitle, deck-studio, and xhs-commercial-growth. They can be enabled and used independently of each other and independently of the main scraping pipeline.
faster-whisper is optional but recommended for bili-subtitle. Without it, the bili-subtitle Skill can only process Bilibili videos that have an official subtitle track. Videos published without subtitles will fail unless faster-whisper is installed to enable local ASR fallback.
Report format default. The generate_report.py script defaults to markdown output when --format is omitted. Use --format json if you need machine-readable output for downstream processing.
Windows and PowerShell are required for the scraping stage. The scraping scripts are PowerShell scripts and depend on Windows OS. The Python parse, compare, and report scripts are cross-platform, but the full pipeline is designed to run on Windows. Plan your environment accordingly.
Rate limiting is your responsibility. The -RateLimit parameter adds a delay between requests to reduce the risk of being throttled. The default values are conservative but not guaranteed to prevent rate limiting on all platforms. If you encounter RateLimitExceeded errors, increase the value and reduce concurrency.