Metadata-Version: 2.4
Name: all-in-one-aione
Version: 0.1.0
Summary: Unified CLI and agent skills for XHS, Weibo, and DouYin APIs.
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: platformdirs>=4.0
Requires-Dist: requests>=2.28.0
Requires-Dist: loguru>=0.7.0
Requires-Dist: python-dotenv>=1.0.0
Requires-Dist: PyExecJS>=1.5.0
Requires-Dist: retry>=0.9.0
Requires-Dist: openpyxl>=3.0.0
Requires-Dist: aiohttp>=3.8.0
Requires-Dist: beautifulsoup4>=4.12.0
Requires-Dist: qrcode>=7.0
Requires-Dist: protobuf>=3.20.0
Requires-Dist: protobuf3-to-dict>=0.1.5
Requires-Dist: websockets>=10.0
Requires-Dist: aiofiles>=23.0.0
Provides-Extra: creator
Requires-Dist: opencv-python>=4.5.0; extra == "creator"
Requires-Dist: numpy>=1.20.0; extra == "creator"
Provides-Extra: weibo-server
Requires-Dist: fastapi>=0.100.0; extra == "weibo-server"
Requires-Dist: uvicorn>=0.20.0; extra == "weibo-server"
Requires-Dist: pandas>=2.0.0; extra == "weibo-server"
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"

# All-IN-ONE

All-IN-ONE turns the APIs from `Spider_XHS`, `WeiboApis`, and `DouYin_Spider` into one local CLI and one unified agent skill.

The CLI command is `aione`.

## Current Status

Implemented:

- `aione` console command (installable via pip)
- `python -m aione` / `python main.py` alternative entry points
- cookie save/status/clear with multi-profile support
- scoped upstream API discovery from `upstreams/`
- dynamic CLI help, dry-run mapping, and `--verbose` debug output
- clean MODULE_DOMAINS command namespacing (no collision suffixes)
- per-platform mapping.py for command-to-upstream traceability
- unified `skills/all-in-one` agent skill with platform references
- integration smoke tests (cookie-gated)

## Install

Recommended: use the `spider` conda environment.

```bash
conda activate spider
```

### Step 1: Install CLI

```bash
pip install -e .
```

This registers `aione` as a global command. After this step, `aione --help` works anywhere.

Optional extras:

```bash
pip install -e ".[creator]"      # XHS creator image/video support (opencv, numpy)
pip install -e ".[weibo-server]" # Weibo FastAPI server (fastapi, uvicorn, pandas)
pip install -e ".[dev]"          # pytest
```

### Step 2: Setup upstream repos

```bash
aione setup
```

This command will:
1. Clone three upstream repos into `upstreams/` (if not already present)
2. Run `npm install` in repos that have `package.json` (XHS and DouYin need Node.js modules for request signing)

Prerequisites: `git` and `npm` (Node.js) must be available in PATH.

If you already have the upstream repos, just place them under `upstreams/`:

```text
upstreams/
  Spider_XHS/      <- git clone https://github.com/cv-cat/Spider_XHS.git
  WeiboApis/       <- git clone https://github.com/cv-cat/WeiboApis.git
  DouYin_Spider/   <- git clone https://github.com/cv-cat/DouYin_Spider.git
```

Then run `aione setup` to install their npm dependencies.

To update upstream repos in the future, simply `git pull` in each directory or delete and re-clone.

### Step 3: Verify

```bash
aione --help
aione xhs --help
aione douyin work info --dry-run --url "https://www.douyin.com/video/example"
```

## Local Upstreams

The three source repositories are kept locally under `upstreams/`, managed via `aione setup`:

- `Spider_XHS` — XHS (小红书) PC/Creator/PuGongYing/QianFan APIs
- `WeiboApis` — Weibo (微博) Web/Creator/Mobile APIs
- `DouYin_Spider` — DouYin (抖音) APIs

`upstreams/` is gitignored. These are development-only checkouts for API discovery and runtime invocation. To update, `git pull` in each directory or delete and re-run `aione setup`.

## Run The CLI

Any of these work after installation:

```bash
aione --help
python -m aione --help
python main.py --help
```

Example dry-run:

```bash
aione douyin work info --dry-run --url "https://www.douyin.com/video/example"
```

Verbose mode shows debug context to stderr without leaking cookie values:

```bash
aione douyin work info --verbose --cookies "<cookie>" --url "https://www.douyin.com/video/example"
```

## Auth

Cookie priority:

1. `--cookies`
2. environment variable
3. saved local cookie

Environment variables:

```bash
AIONE_XHS_COOKIES="<cookie>"
AIONE_WEIBO_COOKIES="<cookie>"
AIONE_DOUYIN_COOKIES="<cookie>"
```

Profile-specific:

```bash
AIONE_XHS_CREATOR_COOKIES="<cookie>"
AIONE_DOUYIN_LIVE_COOKIES="<cookie>"
```

Saved cookie commands:

```bash
aione auth xhs set-cookie --cookie "<cookie>"
aione auth xhs set-cookie --profile creator --cookie "<cookie>"
aione auth xhs status
aione auth xhs clear-cookie
```

One-off cookie:

```bash
aione xhs note search --query "coffee" --cookies "<cookie>"
```

## 真实接口测试

I can run real CLI tests as soon as you provide valid cookies. Needed inputs:

- XHS cookie from logged-in web session
- Weibo cookie from logged-in web session
- DouYin cookie from logged-in `www.douyin.com`
- DouYin live cookie from `live.douyin.com` later, when live APIs are tested

Run integration tests:

```bash
AIONE_XHS_COOKIES="<cookie>" AIONE_WEIBO_COOKIES="<cookie>" AIONE_DOUYIN_COOKIES="<cookie>" python -m pytest tests/ -m integration -v
```

Recommended first smoke tests:

```bash
aione xhs user self-info --cookies "<xhs_cookie>" --output json
aione weibo info self --cookies "<weibo_cookie>" --output json
aione douyin work info --url "<douyin_video_url>" --cookies "<douyin_cookie>" --output json
```

Do not paste cookies into public logs. Prefer setting them via `aione auth <platform> set-cookie --cookie "<cookie>"` in this local workspace.

## Agent Skill

The project exposes one all-in-one skill:

```text
skills/
  all-in-one/
    SKILL.md
    references/
      auth.md
      xhs.md
      weibo.md
      douyin.md
      workflows.md
```

The skill uses `references/` to choose platform-specific commands while keeping one shared All-IN-ONE entry point.

## Dependencies

Core runtime dependencies are defined in `pyproject.toml` and mirrored in `requirements.txt`. The upstream repositories require:

- `requests`, `aiohttp` (HTTP)
- `loguru` (logging)
- `PyExecJS` (JS execution for XHS/DouYin signing)
- `beautifulsoup4` (HTML parsing)
- `protobuf`, `protobuf3-to-dict` (DouYin live data)
- `qrcode` (XHS login)
- And more — see `requirements.txt` for the full list
