| name | gram |
| description | Instagram CLI for viewing feeds, posts, profiles, and engagement via cookies. |
| homepage | https://github.com/arein/gram |
| metadata | {"clawdbot":{"emoji":"📸","requires":{"bins":["gram"]},"install":[{"id":"npm","kind":"node","package":"@cyberdrk/gram","bins":["gram"],"label":"Install gram (npm)"}]}} |
gram 📸
Instagram CLI using REST/GraphQL API + cookie auth.
Install
npm install -g @cyberdrk/gram
bunx @cyberdrk/gram whoami
Authentication
gram uses cookie-based auth from your Instagram web session.
Use --session-id, --csrf-token, and --ds-user-id to pass cookies directly, or --cookie-source for browser cookies.
Run gram check to see which source is active. For Arc/Brave, use --chrome-profile-dir <path>.
Commands
Account & Auth
gram whoami
gram check
gram query-ids --refresh
Reading Posts
gram post <shortcode-or-url>
gram <shortcode-or-url>
gram comments <shortcode> -n 20
gram likers <shortcode>
Feeds
gram feed -n 20
gram explore -n 20
User Profiles
gram user <username>
gram user @instagram --json
gram posts <username> -n 20
gram following [username]
gram followers [username]
Search
gram search "query"
gram search "coffee" --type users
gram search "nyc" --type places
gram search "#photography" --type hashtags
Engagement Actions
gram like <shortcode>
gram unlike <shortcode>
gram save <shortcode>
gram unsave <shortcode>
gram comment <shortcode> "nice!"
gram follow <username>
gram unfollow <username>
Output Options
--json
--json-full
--plain
--no-emoji
--no-color
Global Options
--session-id <token>
--csrf-token <token>
--ds-user-id <id>
--cookie-source <source>
--chrome-profile <name>
--chrome-profile-dir <path>
--firefox-profile <name>
--timeout <ms>
--cookie-timeout <ms>
Config File
~/.config/gram/config.json5 (global) or ./.gramrc.json5 (project):
{
cookieSource: ["safari", "chrome"],
chromeProfile: "Profile 1",
timeoutMs: 60000
}
Environment variables: GRAM_TIMEOUT_MS, GRAM_COOKIE_TIMEOUT_MS
Troubleshooting
Query IDs stale (404 errors)
gram query-ids --refresh
Cookie extraction fails
- Check browser is logged into Instagram
- Try different
--cookie-source
- For Arc/Brave: use
--chrome-profile-dir
- Provide cookies manually:
--session-id, --csrf-token, --ds-user-id
User-agent mismatch errors
- The CLI uses desktop user-agent by default
- If your session was created on mobile, it may fail
- Create a new session by logging in via desktop browser
TL;DR: View feeds, profiles, search, and engage with Instagram via CLI. 📸