Skip to Content
Documentation

Automation and exports

Consume JSON results, stream JSONL catalog records, and resume interrupted exports.

JSON output

nekostream search "one piece" --json
nekostream --provider anime47 catalog --section latest --page 1 --json

Successful command output uses an envelope like this illustrative search result:

{
  "schemaVersion": 1,
  "status": "ok",
  "data": [
    { "id": "ANIME_ID", "title": "Example title" }
  ]
}

The shape of data depends on the command: search and episodes return arrays; catalog returns an object with items and pagination. Additional provider fields can be present. Data goes to stdout; diagnostics, progress, and errors go to stderr.

For example, with jq installed:

nekostream search "one piece" --json | jq -r '.data[] | [.id, .title] | @tsv'

Export catalog records

nekostream scrape catalog --section latest --max-pages 20 --concurrency 2 --jsonl > anime.jsonl

Each line is an independent envelope containing one item and its page:

{"schemaVersion":1,"status":"ok","page":1,"data":{"id":"ANIME_ID","title":"Example title"}}

--jsonl is specific to scrape catalog. The final summary goes to stderr and includes pages, items, nextPage, limitReached, partial, and a suggested resume command. Keep stdout and stderr separate when saving JSONL. Do not use 2>&1 for the data file.

Without --jsonl, use --json to receive one result containing data.items and data.pagination after the scrape finishes:

nekostream --provider anime47 scrape catalog --section upcoming --max-pages 5 --json

Limits and continuation

OptionDefaultAllowed values
--sectionlatestlatest, trending, upcoming
--start-page1Positive page number
--max-pages51–1000 pages per invocation
--concurrency21–4 concurrent page operations

Requests are paced per host. Increasing concurrency does not remove provider limits. Scraping also stops on an empty page or a page with no new IDs.

On an error or Ctrl+C, completed records remain available and the summary reports where to continue. Use its actual nextPage value. For example, if it reports 21:

nekostream scrape catalog --section latest --start-page 21 --max-pages 20 --jsonl >> anime.jsonl

Repeat the original provider and section. The resume suggestion does not preserve custom --data-dir, --base-url, or concurrency options; add them again when needed. Deduplication applies within each invocation. If the provider catalog changes between runs, deduplicate the combined export by provider and anime ID.

Errors and exit codes

With --json, errors handled by command dispatch use a structured stderr envelope:

{
  "schemaVersion": 1,
  "status": "error",
  "error": {
    "code": "auth_required",
    "message": "Provider login is required",
    "fix": "nekostream doctor --json",
    "transient": false
  }
}

The message above is illustrative; actual messages may be Vietnamese. Stderr can also include progress or scrape summaries. --jsonl alone does not enable --json error envelopes; add both flags if you need them.

Exit codeMeaning
0Command completed
1Runtime or network error
2Invalid arguments or deferred provider
3Authentication required
4Anime, episode, or stream not found
130Cancelled

Supply watch --episode and --server for noninteractive selection. Use --yes for history clear and settings reset in scripts. Browser login still requires user interaction. doctor can exit successfully with a missing player, and update --check can report a failed check in its data; inspect the fields as described in troubleshooting.

On this page