Skip to content

feat(bilibili): add creator analytics adapter - #2268

Open
ele-yufo wants to merge 2 commits into
jackwener:mainfrom
ele-yufo:agent/bilibili-creator-stats
Open

feat(bilibili): add creator analytics adapter#2268
ele-yufo wants to merge 2 commits into
jackwener:mainfrom
ele-yufo:agent/bilibili-creator-stats

Conversation

@ele-yufo

@ele-yufo ele-yufo commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

What changed

  • add opencli bilibili creator-stats <owned-bvid> for creator-only manuscript diagnostics, conversion, and retention data
  • use the supported browser page.fetchJson() primitive with the current creator-center login session
  • preserve complete metric paths while reporting every value as platform_raw instead of inferring percentages, seconds, or scores
  • classify invalid arguments, missing videos, expired login/permissions, ownership mismatch, transport failures, malformed schemas, and valid empty analytics with typed errors
  • add focused adapter tests, generated manifest metadata, and Bilibili command documentation

Strategy note

  • Strategy: PAGE_FETCH at the data-contract level, represented by registry Strategy.COOKIE to acquire the logged-in browser session.
  • Contract: internal-unstable.
  • Observed sources: public /x/web-interface/view plus authenticated creator-center /archive_diagnose/compare, /archive_diagnose/play_analyze, and /archive/analyze/graph endpoints.
  • Public API is insufficient because it lacks creator-only completion, audience, conversion, peer-baseline, and retention fields.
  • UI/DOM extraction is not safer because the creator center renders selected summaries and chart state rather than the complete raw metric paths.
  • Maintenance boundary: these endpoints are undocumented and may drift. The adapter fails closed on envelope/schema changes and deliberately avoids semantic unit conversion.

Validation

  • real logged-in E2E against one owned manuscript: 255 rows across four source groups
  • creator play count matched both the public video endpoint and the visible creator-center manuscript card; creator duration matched the visible card duration
  • opencli browser ... verify bilibili/creator-stats --strict-memory: fixture match
  • invalid BVID: ARGUMENT, exit 2
  • valid non-owned BVID: AUTH_REQUIRED, exit 77
  • focused Vitest: 9/9 passed
  • full test suite: 587 files, 6593 tests passed, 1 skipped
  • npm run build, npm run typecheck, npm run docs:build
  • npm run check:typed-error-lint, npm run check:silent-column-drop
  • opencli validate bilibili/creator-stats

Known limitations

  • deep analytics require an active creator-center login and an owned manuscript
  • the retention graph currently uses the first cid; multipart manuscript per-part selection is not exposed yet
  • internal creator-center endpoint or field drift will require maintenance; raw paths make that drift explicit rather than silently mislabeling values

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant