# How to Use the sau CLI Command for All Supported Platforms

> Master the sau CLI command to authenticate and publish content across Douyin, Kuaishou, Xiaohongshu, Bilibili, and Tencent Channels. Learn how to use this powerful tool for all supported platforms.

- Repository: [Alleria/social-auto-upload](https://github.com/dreammis/social-auto-upload)
- Tags: how-to-guide
- Published: 2026-05-31

---

**The `sau` CLI command provides a unified entry point to authenticate, validate sessions, and publish content across Douyin, Kuaishou, Xiaohongshu, Bilibili, and Tencent Channels through platform-specific subcommands orchestrated by the `build_parser()` and `dispatch()` functions in [`sau_cli.py`](https://github.com/dreammis/social-auto-upload/blob/main/sau_cli.py).**

The `sau` CLI serves as the central automation engine for the *social-auto-upload* repository by dreammis, wrapping Playwright-based browser automation in a hierarchical command structure. Each platform implements its own login, validation, and upload logic within the `uploader/` package, while the CLI handles argument parsing, cookie persistence, and runtime configuration through standardized flags.

## CLI Architecture and Dispatch System

The command-line interface is driven by two core functions in **[sau_cli.py](https://github.com/dreammis/social-auto-upload/blob/main/sau_cli.py)**:

- **`build_parser()`** constructs a hierarchical argument parser that creates subcommands for each platform (Douyin, Kuaishou, Xiaohongshu, Bilibili, Tencent) and their respective actions (login, check, upload-video, upload-note)
- **`dispatch()`** routes parsed arguments to the appropriate helper functions (`login_*`, `check_*`, `upload_*`) and determines whether to use immediate or scheduled publishing based on the presence of the `--schedule` flag

All upload requests are validated through dataclasses before reaching platform-specific implementations, ensuring type safety across the execution pipeline.

## Authentication and Cookie Management

The CLI maintains persistent sessions by storing authentication cookies in JSON files under `<BASE_DIR>/cookies/<platform>_<account>.json`, managed by the `resolve_account_file` helper. When you execute a login command, the browser automation creates or refreshes these cookie files, subsequent commands automatically load them to bypass repeated authentication.

To force a fresh login, simply delete the corresponding cookie file in the `cookies/` directory and rerun the login command for that platform and account combination.

## Platform-Specific Command Reference

### Douyin (抖音)

Douyin commands utilize `DouYinVideo` and `DouYinNote` classes from **[uploader/douyin_uploader/main.py](https://github.com/dreammis/social-auto-upload/blob/main/uploader/douyin_uploader/main.py)**.

**Login and verify authentication:**

```bash
sau douyin login --account myDouyin --headless
sau douyin check --account myDouyin

```

**Upload video content:**

```bash
sau douyin upload-video --account myDouyin --file path/video.mp4 --title "My Clip" --desc "Description here" --tags tag1,tag2 --thumbnail path/thumb.jpg --schedule "2024-12-01 10:00"

```

**Publish image notes:**

```bash
sau douyin upload-note --account myDouyin --images img1.jpg img2.jpg --title "My Note" --note "Note text content" --tags note1,note2

```

### Kuaishou (快手)

Kuaishou automation relies on `KSVideo` and `KSNote` from **[uploader/ks_uploader/main.py](https://github.com/dreammis/social-auto-upload/blob/main/uploader/ks_uploader/main.py)**.

**Account setup and validation:**

```bash
sau kuaishou login --account ksUser --headless
sau kuaishou check --account ksUser

```

**Content publishing commands:**

```bash
sau kuaishou upload-video --account ksUser --file vid.mp4 --title "KS Title" --desc "Description" --tags ks,demo --thumbnail thumb.jpg
sau kuaishou upload-note --account ksUser --images img1.png img2.png --title "KS Note" --note "Note body text"

```

### Xiaohongshu (小红书)

Xiaohongshu integration uses `XiaoHongShuVideo` and `XiaoHongShuNote` classes defined in **[uploader/xiaohongshu_uploader/main.py](https://github.com/dreammis/social-auto-upload/blob/main/uploader/xiaohongshu_uploader/main.py)**.

**Authentication workflow:**

```bash
sau xiaohongshu login --account xhsUser
sau xiaohongshu check --account xhsUser

```

**Media upload examples:**

```bash
sau xiaohongshu upload-video --account xhsUser --file video.mp4 --title "XHS Video" --desc "Example description" --tags xhs,example --thumbnail thumb.png
sau xiaohongshu upload-note --account xhsUser --images pic1.jpg pic2.jpg --title "XHS Note" --note "Note text content"

```

### Bilibili

Unlike other platforms, Bilibili uses the external **biliup** binary through the `run_biliup_command` function in **[uploader/bilibili_uploader/runtime.py](https://github.com/dreammis/social-auto-upload/blob/main/uploader/bilibili_uploader/runtime.py)**.

**Authentication and upload commands:**

```bash
sau bilibili login --account biliUser
sau bilibili check --account biliUser
sau bilibili upload-video --account biliUser --file vid.mp4 --title "Bili Video" --desc "Video description" --tid 17 --tags demo,video --schedule "2024-11-15 08:30"

```

Note that Bilibili login requires an interactive terminal session to complete the authentication flow.

### Tencent / WeChat Channels

Tencent video uploads are handled by the `TencentVideo` class in **[uploader/tencent_uploader/main.py](https://github.com/dreammis/social-auto-upload/blob/main/uploader/tencent_uploader/main.py)**.

**Standard workflow:**

```bash
sau tencent login --account wxUser --headless
sau tencent check --account wxUser

```

**Video upload with draft option:**

```bash
sau tencent upload-video --account wxUser --file vid.mp4 --title "WX Title" --desc "Description" --tags wx,video --thumbnail thumb.jpg --short-title "Short Title" --category "Entertainment" --draft

```

The `--draft` flag saves the video without publishing, allowing manual review in the platform interface.

## Global Runtime Flags

The `add_runtime_flags()` function in [`sau_cli.py`](https://github.com/dreammis/social-auto-upload/blob/main/sau_cli.py) defines parameters available across all platform commands:

- **`--account <name>`** – Specifies the account identifier used to locate the cookie file at `cookies/<platform>_<account>.json`
- **`--debug`** – Enables verbose diagnostic output for troubleshooting browser automation
- **`--headless` / `--headed`** – Controls browser visibility; headless mode runs without UI (default), while headed mode shows the browser window
- **`--schedule "<YYYY-MM-DD HH:MM>"`** – Schedules content for future publication; omitted for immediate upload
- **`--tags "tag1,tag2"`** – Comma-separated tag list; accepts empty strings for no tags

File path arguments (`--file`, `--thumbnail`, `--images`) are validated using `existing_file_path` validators before processing begins.

## Summary

- The `sau` CLI command centralizes control for five major Chinese social media platforms through a modular architecture in [`sau_cli.py`](https://github.com/dreammis/social-auto-upload/blob/main/sau_cli.py)
- Authentication cookies are persisted to JSON files under the `cookies/` directory, keyed by platform and account name
- Each platform supports `login`, `check`, `upload-video`, and `upload-note` actions dispatched through the `dispatch()` function
- Bilibili uniquely relies on the external `biliup` binary rather than native Playwright classes
- The `--schedule` flag enables delayed publishing across all platforms except where noted, while `--draft` is specific to Tencent Channels

## Frequently Asked Questions

### How does the sau CLI store and manage authentication credentials?

The CLI stores session cookies in platform-specific JSON files located at `<BASE_DIR>/cookies/<platform>_<account>.json`, managed by the `resolve_account_file` function. These files are created during the login process and automatically refreshed when tokens expire. No passwords are stored locally; the cookie files contain only session tokens obtained through QR-code or interactive browser authentication.

### Can I schedule posts for future publication using the sau CLI?

Yes, all supported platforms accept the `--schedule` flag with a datetime string in `"YYYY-MM-DD HH:MM"` format. When provided, the `dispatch()` function routes the request through the scheduling logic rather than immediate publication. If the flag is omitted, content publishes immediately upon successful upload.

### What is the difference between upload-video and upload-note commands?

The `upload-video` command processes single video files with optional thumbnails and metadata, utilizing platform-specific video classes like `DouYinVideo` or `XiaoHongShuVideo`. The `upload-note` command handles multi-image posts (carousels) with accompanying text, using note-specific classes such as `DouYinNote` or `KSNote`. Note commands require the `--images` flag accepting multiple image paths rather than a single `--file` argument.

### Why does Bilibili authentication require different handling than other platforms?

Bilibili uses the external **biliup** binary rather than native Playwright automation classes. The CLI invokes `run_biliup_command` from **[uploader/bilibili_uploader/runtime.py](https://github.com/dreammis/social-auto-upload/blob/main/uploader/bilibili_uploader/runtime.py)** to handle authentication and uploads, which requires an interactive terminal for the initial login process and uses its own cookie storage mechanism separate from the other platforms' JSON files.