@fc2cma/cli
v0.3.0
Published
Unofficial CLI for the FC2 Content Market (Adult): subscribe to sellers, sync works into SQLite, track prices, cross-check sukebei magnets.
Downloads
433
Readme
fc2cma
Unofficial CLI for the FC2 Content Market (Adult). Subscribe to a list of sellers, sync their works into a local SQLite DB, track price history, and cross-check against sukebei magnets — all in a shape an AI agent can loop over.
Install
bun installOptional: put your FC2 session cookie in .env so the crawler can see
seller pages that gate content behind login:
FC2_COOKIE=...
# FC2CMA_DB=~/.fc2cma/db.sqlite # default path, override if you wantQuickstart
# Run ad-hoc without a global install: `pnpx @fc2cma/cli <args>`
# (also works with `bunx` / `npx`). In the dev checkout,
# `bun start <args>` is equivalent to `fc2cma <args>`.
# 1. Subscribe to a seller
fc2cma subscribe add <author-slug>
# 2. Pull their works (fast; listing only)
fc2cma sync --author <author-slug>
# 3. Same, with detail-page backfill for publish dates & prices
fc2cma sync --author <author-slug> --with-detail
# 4. Same, with sukebei magnet cross-check
fc2cma sync --author <author-slug> --with-sukebei
# 5. Browse
fc2cma list --author <author-slug> --since 2024-01-01
fc2cma info --id <work-id>
fc2cma whats-new --since-last-syncCommands
| command | what it does |
|---|---|
| subscribe add/remove/list | manage the seller subscription list. remove preserves history; remove --purge cascades. |
| sync [--author X \| --all] | fetch the FC2 listing and upsert works. Add --with-detail for date/price backfill, --with-sukebei to record magnets. |
| list --author X [--since --until] | list an author's works, optionally in a time window. |
| info --id <work-id> | full detail for one work: metadata, price timeline, and magnets (if synced). |
| whats-new [--since X \| --since-last-sync] | aggregated diff for agents: new releases, price drops, new magnets. |
| sukebei --author X | ad-hoc magnet lookup for every work of an author, without touching the DB. |
AI-agent contract
Every command accepts --json. stdout is then a single line:
{ "ok": true, "command": "whats-new", "generatedAt": 1713500000000,
"data": { ... }, "warnings": [] }All time fields in both the DB and the JSON output are ms since epoch
(Date.now() values). --since / --until on the CLI accept either
YYYY-MM-DD, full ISO 8601, or a numeric ms string — parsed once at
the boundary by src/utils/dates.ts.
Exit codes:
0ok2usage error (bad flag / missing required / mutex violated)3network-dominated failure (all FC2 pages failed, sukebei all errored)4partial (reserved for hard degradations — currently unused)
stderr carries human chatter and warnings. When --json is set, all
chalk progress lines redirect to stderr so stdout stays parseable.
A typical agent loop:
fc2cma sync --all --with-detail --with-sukebei --json > /dev/null
fc2cma whats-new --since-last-sync --jsonStorage
Single SQLite file at ~/.fc2cma/db.sqlite (overridable via FC2CMA_DB
env or --db flag). WAL mode; bun:sqlite, no extra dependencies.
Price history is append-on-change: a new row lands only when
(price_yen, on_promo) differs from the latest observation for that
work. Schema lives in src/db/migrations.ts.
Scripts
bun run typecheck— strict TypeScript checkbun run lint— ESLint + Prettierbun test— unit tests (pure helpers: dates, price-diff, sukebei-diff)
Status
Phase 1 — subscriptions, listing sync, info/list — merged.
Phase 2 — price history, detail-page backfill, whats-new — merged.
Phase 3 — sukebei integration, sukebei ad-hoc command — this branch.
Disclaimer
Unofficial tool — not affiliated with, endorsed by, or sponsored by FC2, Inc. or sukebei. It simply reads publicly reachable pages on behalf of the signed-in user, the same way a browser would. No media is downloaded or redistributed; only bibliographic metadata (title, price, publish date, magnet URI) is stored locally. The target site hosts adult material — use only where that is legal for you, and only for works you have the right to access. You are responsible for complying with the target sites' Terms of Service and your local laws. Provided as-is, with no warranty (see LICENSE).
