/install gram
gram 📸
Instagram CLI using REST/GraphQL API + cookie auth.
Install
# npm/pnpm/bun
npm install -g @cyberdrk/gram
# One-shot (no install)
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 \x3Cpath>.
Commands
Account & Auth
gram whoami # Show logged-in account
gram check # Show credential sources
gram query-ids --refresh # Refresh GraphQL query ID cache
Reading Posts
gram post \x3Cshortcode-or-url> # View a post
gram \x3Cshortcode-or-url> # Shorthand for post
gram comments \x3Cshortcode> -n 20 # View comments on a post
gram likers \x3Cshortcode> # View users who liked a post
Feeds
gram feed -n 20 # Home feed
gram explore -n 20 # Explore/discover feed
User Profiles
gram user \x3Cusername> # View user profile
gram user @instagram --json # JSON output
gram posts \x3Cusername> -n 20 # User's posts
gram following [username] # Users someone follows (defaults to you)
gram followers [username] # Someone's followers (defaults to you)
Search
gram search "query" # Search users, hashtags, places
gram search "coffee" --type users
gram search "nyc" --type places
gram search "#photography" --type hashtags
Engagement Actions
gram like \x3Cshortcode> # Like a post
gram unlike \x3Cshortcode> # Unlike a post
gram save \x3Cshortcode> # Save/bookmark a post
gram unsave \x3Cshortcode> # Unsave a post
gram comment \x3Cshortcode> "nice!" # Comment on a post
gram follow \x3Cusername> # Follow a user
gram unfollow \x3Cusername> # Unfollow a user
Output Options
--json # JSON output
--json-full # JSON with raw API response in _raw field
--plain # No emoji, no color (script-friendly)
--no-emoji # Disable emoji
--no-color # Disable ANSI colors (or set NO_COLOR=1)
Global Options
--session-id \x3Ctoken> # Instagram sessionid cookie
--csrf-token \x3Ctoken> # Instagram csrftoken cookie
--ds-user-id \x3Cid> # Instagram ds_user_id cookie
--cookie-source \x3Csource> # Cookie source for browser cookies (repeatable)
--chrome-profile \x3Cname> # Chrome profile name
--chrome-profile-dir \x3Cpath> # Chrome/Chromium profile dir or cookie DB path
--firefox-profile \x3Cname> # Firefox profile
--timeout \x3Cms> # Request timeout
--cookie-timeout \x3Cms> # Cookie extraction timeout
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. 📸
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install gram - 安装完成后,直接呼叫该 Skill 的名称或使用
/gram触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
Instagram Skill via cyberdrk/gram CLI 是什么?
Instagram CLI for viewing feeds, posts, profiles, and engagement via cookies. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 3152 次。
如何安装 Instagram Skill via cyberdrk/gram CLI?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install gram」即可一键安装,无需额外配置。
Instagram Skill via cyberdrk/gram CLI 是免费的吗?
是的,Instagram Skill via cyberdrk/gram CLI 完全免费(开源免费),可自由下载、安装和使用。
Instagram Skill via cyberdrk/gram CLI 支持哪些平台?
Instagram Skill via cyberdrk/gram CLI 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Instagram Skill via cyberdrk/gram CLI?
由 arein(@arein)开发并维护,当前版本 v1.0.0。