Skip to main content

CLI helpers for user-authorized Maimai web sessions

Project description

maimai-cli

Unofficial CLI helpers for user-authorized Maimai web sessions.

This project is intended for personal, low-volume access to content that the signed-in user can already view in the browser. It does not provide login bypasses, CAPTCHA solving, anti-bot bypasses, or bulk scraping workflows.

Safety Model

  • You must provide your own valid Cookie header from a browser session you control.
  • Cookies are stored locally under ~/.maimai-cli/cookies.json with best-effort 0600 permissions.
  • The CLI only uses same-origin Maimai web endpoints and user-visible pages.
  • Do not use this project to access accounts, companies, feeds, posts, comments, or profiles that you are not authorized to view.
  • Respect Maimai's terms, privacy expectations, rate limits, and applicable law.
  • Keep request volume low. This tool is designed for interactive use, not continuous crawling.

Install

From PyPI:

pip install maimai-cli
maimai --help

With uvx:

uvx maimai-cli --help

From source:

git clone https://github.com/mariotong/maimai-cli.git
cd maimai-cli
uv run maimai --help

Authentication

This CLI does not read browser cookie stores automatically and does not support QR login. Import a Cookie header explicitly:

maimai import-cookie-header --cookie '<paste your Cookie header here>'

You can also use an environment variable or stdin:

MAIMAI_COOKIE='<paste your Cookie header here>' maimai import-cookie-header

Check local authentication evidence:

maimai status

Remove saved cookies:

maimai logout

Usage

Read a visible community feed:

maimai feed --type recommended --limit 20
maimai feed --type gossip --offset 20 --limit 20

Read the current account's visible company circle feed:

maimai company-feed --limit 20

Read a specific company circle if you already know its webcid:

maimai company-feed <webcid> --limit 20

After any listing command, entries are saved as short indexes. You can use those indexes for details, comments, images, and profiles:

maimai detail 1 --kind gossip
maimai comments 1 --kind gossip --limit 20
maimai images 1 --kind gossip

Search visible content:

maimai search "keyword" --limit 5

Use JSON output for scripts:

maimai feed --type gossip --limit 5 --json

Dynamic Action IDs

Some Maimai web features use Next.js server action IDs. The CLI ships with known defaults and keeps a local runtime cache at ~/.maimai-cli/actions.json. If an action fails, the client can scan currently visible pages for candidate action IDs, retry conservatively, and cache a working value.

This mechanism is for compatibility with normal web-page changes. It is not intended to bypass access controls or anti-abuse systems.

Development

Run local checks:

uv run python -m py_compile maimai_cli/*.py maimai_cli/commands/*.py
uv run python -m unittest

Build the package:

uv build

Publish to PyPI:

UV_PUBLISH_TOKEN='<your PyPI API token>' uv publish

Project Status

Alpha. Endpoints and page structures may change without notice. Expect breakage and treat output as best-effort.

Disclaimer

This project is unofficial and is not affiliated with, endorsed by, or sponsored by Maimai. Use it only with accounts and data you are authorized to access.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

maimai_cli-0.3.1.tar.gz (32.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

maimai_cli-0.3.1-py3-none-any.whl (28.5 kB view details)

Uploaded Python 3

File details

Details for the file maimai_cli-0.3.1.tar.gz.

File metadata

  • Download URL: maimai_cli-0.3.1.tar.gz
  • Upload date:
  • Size: 32.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for maimai_cli-0.3.1.tar.gz
Algorithm Hash digest
SHA256 3cd01f066466e120e4f99b71a76a98da4c99f57c26b3f4f1412d01ee05c41a48
MD5 7eedbf9ff23c1f68a02a3028c789db12
BLAKE2b-256 bfd1a3b93d0b3a5771c81377ff4bc1e03f7e1ac39457d86863ab38eb9083cf0f

See more details on using hashes here.

File details

Details for the file maimai_cli-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: maimai_cli-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 28.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for maimai_cli-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b93d9124b3e62c803691f0d3cc04bf1235930e4cec296d56e89ab1316b7c5bd4
MD5 c982ebf77143e7584ba5c1450f53f50a
BLAKE2b-256 213a10205c405d636be67a6bff7e63d126a6215a7e57cb6df96693d823965bd6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page