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
| Code | Meaning |
|---|---|
0 | Success. |
1 | A request failed: network, block, missing post, parse error. |
2 | Usage error or unsupported URL. |
130 | The 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.