Expand description
§amagi
Chinese README: README.zh-CN.md
amagi is a Rust SDK, CLI, and JSON Web API service for multi-platform social web adapters.
§What It Does
- Run CLI tasks against Bilibili, Douyin, Kuaishou, Twitter/X, and Xiaohongshu
- Start a local JSON Web API with
amagi serve - Reuse the same capability as a Rust crate with feature flags
§Quick Start
Install the latest release:
Linux/macOS:
curl -fsSL https://raw.githubusercontent.com/bandange/amagi-rs/main/scripts/install.sh | bashPowerShell:
irm https://raw.githubusercontent.com/bandange/amagi-rs/main/scripts/install.ps1 | iexUse proxy mode:
Linux/macOS:
curl -fsSL https://gh-proxy.com/https://raw.githubusercontent.com/bandange/amagi-rs/main/scripts/install.sh | bash -s -- --proxyPowerShell:
& ([scriptblock]::Create((irm "https://gh-proxy.com/https://raw.githubusercontent.com/bandange/amagi-rs/main/scripts/install.ps1"))) -ProxyVerify:
amagi --versionCommon examples:
amagi run douyin video-work <aweme_id>
amagi run bilibili emoji-list
amagi run twitter user-profile <screen_name>
amagi serve --host 127.0.0.1 --port 4567For install, update, uninstall, and shell integration details, see the installation guide.
§Run From Source
If you do not want to install the binary, run it directly in the repository. This requires a local Rust toolchain.
cargo run -- run
cargo run -- run douyin video-work <aweme_id>
cargo run -- serve --host 127.0.0.1 --port 4567§Configuration
Configuration is loaded in this order:
- the user-level dotenv file
- the current directory
.env
User-level dotenv path:
- Linux/macOS:
~/.config/amagi/.env - Windows:
%APPDATA%\\amagi\\.env
Useful files and variables:
.env.exampleAMAGI_USER_ENV_FILEAMAGI_DOUYIN_COOKIEAMAGI_BILIBILI_COOKIEAMAGI_KUAISHOU_COOKIEAMAGI_TWITTER_COOKIEAMAGI_XIAOHONGSHU_COOKIEAMAGI_HOSTAMAGI_PORT
For the full environment and CLI option list, see the CLI reference.
§Crate Features
Default features: client, cli, server
Optional features:
catalog: static catalog and route metadata onlyclient: Rust client types and upstream fetcherscli: command-line runtimeserver: Axum-based HTTP service
Example:
amagi = { version = "0.1.4", default-features = false, features = ["client"] }§Documentation
- Installation guide: docs/installation/README.md
- CLI reference: docs/reference/cli-reference.md
- SDK reference: docs/reference/sdk-reference.md
- Web API reference: docs/reference/web-api-reference.md
- API catalog reference: docs/reference/api-catalog-reference.md
Chinese documentation:
- Installation guide: docs/installation/README.zh-CN.md
- CLI reference: docs/reference/cli-reference.zh-CN.md
- SDK reference: docs/reference/sdk-reference.zh-CN.md
- Web API reference: docs/reference/web-api-reference.zh-CN.md
- API catalog reference: docs/reference/api-catalog-reference.zh-CN.md
Re-exports§
pub use catalog::ApiMethodSpec;pub use catalog::HttpMethod;pub use catalog::ParsePlatformError;pub use catalog::Platform;pub use catalog::PlatformSpec;pub use catalog::all_platform_specs;pub use catalog::find_method;pub use catalog::get_api_route;pub use catalog::get_chinese_method_name;pub use catalog::get_english_method_name;pub use catalog::method_specs;pub use catalog::platform_spec;pub use client::AmagiClient;pub use client::ClientOptions;pub use client::CookieConfig;pub use client::PlatformClient;pub use client::RequestConfig;pub use client::RequestProfile;pub use client::create_amagi_client;pub use error::AppError;pub use events::AmagiEvent;pub use events::AmagiEventType;pub use events::ApiErrorEventData;pub use events::ApiSuccessEventData;pub use events::EventBus;pub use events::EventLogLevel;pub use events::HttpRequestEventData;pub use events::HttpResponseEventData;pub use events::LogEventData;pub use events::NetworkErrorEventData;pub use events::NetworkRetryEventData;pub use platforms::bilibili;pub use platforms::douyin;pub use platforms::kuaishou;pub use platforms::twitter;pub use platforms::xiaohongshu;
Modules§
- app
- Application runtime and top-level command dispatch for a resolved
config::AppConfig. Application runtime orchestration for CLI and server modes. - catalog
- Shared catalog metadata and route descriptors for the client and server surfaces. Shared catalog metadata and route descriptors.
- cli
- Command-line argument parsing and conversion into
config::AppConfig. Parse CLI arguments and convert them into runtime configuration values. - client
- Client configuration and platform accessors. SDK-style client configuration and platform accessors.
- config
- Shared configuration types used by the CLI, runtime, and HTTP server. Shared configuration types used by the CLI, runtime, and HTTP server.
- env
.envloading and environment resolution helpers shared across runtimes. Layered dotenv loading and environment resolution helpers.- error
- Shared error types used across the crate. Error types shared across crate entrypoints and runtime helpers.
- events
- Typed event bus shared across the client, CLI, and server flows. Typed event bus shared across SDK, CLI, and web flows.
- output
- Human-readable and machine-readable output helpers. User-facing startup output for text and JSON modes.
- platforms
- Rust-native platform fetchers and shared upstream transport adapters. Rust-native platform fetchers and shared upstream transport helpers.
- server
- HTTP server entrypoint, router, and handlers. HTTP server bootstrap, routing, and request handlers.
- telemetry
- Structured telemetry setup backed by
tracing. Global tracing subscriber initialization and runtime telemetry defaults.
Constants§
- APP_
NAME - Crate name used by CLI output and server metadata.
- DEFAULT_
HOST - Default host used by the built-in HTTP server.
- DEFAULT_
PORT - Default port used by the built-in HTTP server.
Functions§
- print_
startup_ error - Print an
error::AppErrorin a human-friendly fallback format. - run_env
- Parse process arguments and run the application.