Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Script the command

downloader @natgeo --list --json

Progress, prompts and errors go to stderr. Data goes to stdout: the post list of --list, the account of whoami. --json prints one envelope on stdout and turns prompts off:

{ "ok": true, "data": [], "meta": {} }
{ "ok": false, "error": { "code": "not_logged_in", "message": "No Instagram session is saved", "hint": "Run downloader login." } }

For several URLs and for an account, meta.failed lists each post that failed with its url, code and message. For an account, meta.user names the account and meta.platform is instagram or facebook.

An error names the host that failed, never the full URL: media URLs carry signed tokens. A site that wants a signed-in user fails with login_required, and one that refuses the request fails with refused.

NO_COLOR turns colors off. --debug, or DOWNLOADER_DEBUG=1, prints each request as method, host, path, status and time, without the query string. A prompt opens only when stdin and stderr are terminals and CI is unset.

Exit codes

CodeMeaning
0Success.
1A request failed: network, block, missing post, parse error.
2Usage error or unsupported URL.
130The prompt was cancelled.

Config directory

The tool keeps config.json, auth.json and history.jsonl in $XDG_CONFIG_HOME/downloader, which defaults to ~/.config/downloader, or %APPDATA%\downloader on Windows. DOWNLOADER_CONFIG_DIR overrides the path. auth.json holds the session with mode 0600. history.jsonl holds one line per downloaded post: its URL, its files and the time.