mcpField
T
toutiao-publisher

toutiao-publisher

github.com/guanyangMarketing & growth331.1k installsUpdated 2w ago
Repository

About toutiao-publisher

toutiao-publisher is a skill for preparing and publishing articles to Toutiao through Chrome. It supports validation, manual review, and explicitly authorized automatic publishing, with checks for authentication and confirmed success.

Key features

  1. 01Validate article inputs before opening Chrome
  2. 02Fill drafts for manual review
  3. 03Publish automatically with explicit authorization
  4. 04Check and manage Toutiao authentication
  5. 05Support Markdown content and local images

Use cases

  1. 01Prepare a Toutiao article from a Markdown file
  2. 02Review a filled draft before publishing
  3. 03Check whether a shared Toutiao session is authenticated

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/guanyang/super-publisher --skill toutiao-publisher

After installing, type/toutiao-publisherin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

README.md
requirements.txt
scripts/
auth_manager.py
browser_utils.py
cli_utils.py
config.py
md2html.py
publisher.py
run.py
setup_environment.py
tests/
test_auth_manager.py
test_browser_utils.py
test_config.py
test_md2html.py
test_publisher_cli.py
test_publisher_cover_policy.py
test_publisher_debug.py
test_run.py
test_setup_environment.py

Details

From the project README

Toutiao Publisher

Use the scripts from this Skill directory. Resolve the directory containing this SKILL.md first and set its absolute path as SKILL_DIR; do not assume the caller's working directory is the Skill directory.

Safety rules

  • Default to --mode manual. Leave Chrome open for the user to review and click Publish.
  • Use --mode auto only when the user explicitly authorizes final publishing.
  • Run clear --yes or reauth --yes only after the user confirms that all local Agents may lose the shared Toutiao session.
  • Do not bypass input validation or treat an unconfirmed publish click as success.

Preflight authentication

Check the protected Toutiao page before asking the user to scan a QR code:

python3 "$SKILL_DIR/scripts/run.py" auth_manager.py status --verify --json

If the result status is not_authenticated, open the interactive login flow:

python3 "$SKILL_DIR/scripts/run.py" auth_manager.py setup --json

The shared profile lives under ~/.super-publisher/toutiao-publisher/ by default. Codex, Kiro, Antigravity, and direct CLI runs by the same system user reuse it. Set SUPER_PUBLISHER_DATA_DIR to override the location; relative values resolve from the user home directory.

Prepare and publish an article

Validate inputs without opening Chrome:

python3 "$SKILL_DIR/scripts/run.py" publisher.py \
  --mode validate \
  --title "AI Trends 2026" \
  --content-file "/absolute/path/article.md" \
  --cover "/absolute/path/cover.jpg" \
  --json

After validation succeeds, fill the draft and wait for manual review:

python3 "$SKILL_DIR/scripts/run.py" publisher.py \
  --mode manual \
  --title "AI Trends 2026" \
  --content-file "/absolute/path/article.md" \
  --cover "/absolute/path/cover.jpg" \
  --json

Use direct text only through --content-text. --content remains an alias for --content-file; a missing path is an error rather than literal article text.

Markdown supports headings, links, ordered and unordered lists, block quotes, tables, fenced code, inline code, emphasis, and local inline images. Resolve relative image paths from the Markdown file. If the body contains images, skip explicit cover upload. Use --no-cover only when the body has no image and no cover is supplied.

For explicitly authorized automatic publishing:

python3 "$SKILL_DIR/scripts/run.py" publisher.py \
  --mode auto \
  --title "AI Trends 2026" \
  --content-file "/absolute/path/article.md" \
  --headless \
  --json

Automatic publishing succeeds only after Toutiao displays a recognized success indicator. A final-button click without confirmation returns publish_unconfirmed.

Result contract

With --json, authentication commands write one JSON result to stdout. Publisher commands write newline-delimited JSON events; manual mode emits awaiting_manual_review before waiting for the user.

  • Exit 0: authenticated, input valid, manual review completed, or publish confirmed.
  • Exit 1: runtime, browser interaction, draft, upload, or publish failure.
  • Exit 2: invalid input, missing authentication, or clear confirmation required.

Treat stderr as human-readable diagnostics. Do not parse emojis or prose to determine success.

Session management

# Read local state only
python3 "$SKILL_DIR/scripts/run.py" auth_manager.py status --json

# Verify against Toutiao and refresh state
python3 "$SKILL_DIR/scripts/run.py" auth_manager.py validate --json

# Destructive: require explicit user confirmation first
python3 "$SKILL_DIR/scripts/run.py" auth_manager.py clear --yes --json

Environment

Require Python 3.9+, Google Chrome, and local network access. scripts/run.py bootstraps scripts/setup_environment.py, verifies the requirements fingerprint, and executes the target with the Skill-local .venv Python. The shared state directory uses owner-only permissions. Avoid starting concurrent browser operations against the same persistent Chrome Profile.

Enable --debug-screenshots only when troubleshooting. Screenshots are written under output/toutiao-publisher-debug/ by default.

Comments

Markdown supported