Skip to content

Give your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu — one CLI, zero API fees.

polish: cookie header string parsing + Cookie-Editor guide + server user path

Panniantong89b3eaf5da0a
diff --git a/agent_eyes/cli.py b/agent_eyes/cli.py
index 7354b993..94990d2d 100644
--- a/agent_eyes/cli.py
+++ b/agent_eyes/cli.py
@@ -309,11 +309,28 @@ def _cmd_configure(args):
print(f"❌ Failed: {e}")
elif args.key == "twitter-cookies":
- # Expect: auth_token ct0
- parts = value.split()
- if len(parts) == 2:
- config.set("twitter_auth_token", parts[0])
- config.set("twitter_ct0", parts[1])
+ # Accept two formats:
+ # 1. auth_token ct0 (two separate values)
+ # 2. Full cookie header string: "auth_token=xxx; ct0=yyy; ..."
+ auth_token = None
+ ct0 = None
+
+ if "auth_token=" in value and "ct0=" in value:
+ # Full cookie string — parse it
+ for part in value.replace(";", " ").split():
+ if part.startswith("auth_token="):
+ auth_token = part.split("=", 1)[1]
+ elif part.startswith("ct0="):
+ ct0 = part.split("=", 1)[1]
+ elif len(value.split()) == 2 and "=" not in value:
+ # Two separate values: AUTH_TOKEN CT0
+ parts = value.split()
+ auth_token = parts[0]
+ ct0 = parts[1]
+
+ if auth_token and ct0:
+ config.set("twitter_auth_token", auth_token)
+ config.set("twitter_ct0", ct0)
print(f"✅ Twitter cookies configured!")
print("Testing Twitter access...", end=" ")
@@ -321,7 +338,7 @@ def _cmd_configure(args):
import subprocess
result = subprocess.run(
["birdx", "search", "test", "-n", "1",
- "--auth-token", parts[0], "--ct0", parts[1]],
+ "--auth-token", auth_token, "--ct0", ct0],
capture_output=True, text=True, timeout=15,
)
if result.returncode == 0 and result.stdout.strip():
@@ -333,8 +350,10 @@ def _cmd_configure(args):
except Exception as e:
print(f"❌ Failed: {e}")
else:
- print("❌ Usage: agent-eyes configure twitter-cookies AUTH_TOKEN CT0")
- print(" (two values separated by space)")
+ print("❌ Could not find auth_token and ct0 in your input.")
+ print(" Accepted formats:")
+ print(" 1. agent-eyes configure twitter-cookies AUTH_TOKEN CT0")
+ print(' 2. agent-eyes configure twitter-cookies "auth_token=xxx; ct0=yyy; ..."')
elif args.key == "xhs-cookie":
config.set("xhs_cookie", value)
diff --git a/docs/cookie-export.md b/docs/cookie-export.md
new file mode 100644
index 00000000..da2fa12e
--- /dev/null
+++ b/docs/cookie-export.md
@@ -0,0 +1,42 @@
+# Cookie Export Guide — For Server Users
+
+Your Agent is on a server and can't access your browser directly.
+Here's how to export cookies from your local computer — **fastest method first**.
+
+## Method 1: Cookie-Editor Extension (Recommended — 30 seconds per site)
+
+1. Install **Cookie-Editor** for Chrome: https://chromewebstore.google.com/detail/cookie-editor/hlkenndednhfkekhgcdicdfddnkalmdm
+ (Also available for Firefox, Edge)
+
+2. Go to the website (e.g. https://x.com) and make sure you're logged in
+
+3. Click the Cookie-Editor icon in your toolbar
+
+4. Click **Export** → **Header String**
+
+5. Paste the result to your Agent
+
+That's it! Your Agent will run:
+```bash
+agent-eyes configure twitter-cookies <your_pasted_string>
+```
+
+### Sites to export:
+
+| Site | URL to visit | What to tell Agent |
+|------|-------------|-------------------|
+| Twitter/X | https://x.com | "Here are my Twitter cookies: [paste]" |
+| XiaoHongShu | https://www.xiaohongshu.com | "Here are my XHS cookies: [paste]" |
+| Bilibili | https://www.bilibili.com | "Here are my Bilibili cookies: [paste]" |
+
+## Method 2: Manual (No extension needed)
+
+1. Open the site in Chrome, make sure you're logged in
+2. Press **F12** (or right-click → Inspect)
+3. Click the **Network** tab
+4. Refresh the page (F5)
+5. Click any request in the list
+6. In the right panel, scroll to **Request Headers**
+7. Find the line starting with `Cookie:`
+8. Copy the entire value after `Cookie: `
+9. Paste to your Agent
diff --git a/docs/install.md b/docs/install.md
index 4698d344..fa8ed8b9 100644
--- a/docs/install.md
+++ b/docs/install.md
@@ -12,56 +12,80 @@ Install Agent Eyes: https://raw.githubusercontent.com/Panniantong/agent-eyes/mai
## For AI Agents
-Install Agent Eyes and set it up with minimal user effort.
+Install Agent Eyes with minimal user effort. Goal: fewest questions, fewest steps.
-### Step 1: Install and check
+### Step 1: Install and detect
```bash
pip install git+https://github.com/Panniantong/agent-eyes.git || pip3 install git+https://github.com/Panniantong/agent-eyes.git
agent-eyes install --env=auto
```
-### Step 2: One-click cookie import (LOCAL COMPUTERS ONLY)
+Read the output. It tells you the detected environment (local/server) and what's already working.
-If the environment was detected as **local**, offer to grab all cookies at once:
+### Step 2: Set up cookies (the approach depends on environment)
-> "I can automatically import your cookies from Chrome to unlock Twitter, XiaoHongShu, and Bilibili — all at once, one command. Want me to do that?
-> (Make sure Chrome is closed first)"
+#### Path A: Local computer (auto-detected)
-If yes:
+Offer one-click import:
+
+> "I can grab your browser cookies automatically to unlock Twitter, XiaoHongShu, and Bilibili — all at once. Just close Chrome first, then say 'go'."
+
+If user agrees:
```bash
-pip install browser-cookie3
-agent-eyes configure --from-browser chrome
+pip install browser-cookie3 2>/dev/null; agent-eyes configure --from-browser chrome
```
-This extracts cookies for ALL supported platforms in one shot. No F12, no manual copying.
+If user uses another browser: replace `chrome` with `firefox`, `edge`, `brave`, or `opera`.
+
+If it fails or user declines, fall through to Path B.
+
+#### Path B: Server, or auto-import didn't work
+
+Tell the user the easiest manual method:
+
+> "I need cookies from your browser to unlock some platforms. Here's the fastest way (30 seconds per site):
+>
+> 1. Install the **Cookie-Editor** Chrome extension: https://chromewebstore.google.com/detail/cookie-editor/hlkenndednhfkekhgcdicdfddnkalmdm
+> 2. Go to the site (e.g. x.com) — make sure you're logged in
+> 3. Click the Cookie-Editor icon → **Export** → **Header String**
+> 4. Paste the result to me
+>
+> Which platforms do you use? I'll tell you which ones to export."
-If user uses a different browser:
+For each platform the user wants:
+
+**Twitter/X** — export from https://x.com :
```bash
-agent-eyes configure --from-browser firefox # or edge, brave, opera
+agent-eyes configure twitter-cookies "PASTED_COOKIE_STRING"
```
+(Accepts both: full cookie string OR just `auth_token ct0` as two values)
-If the environment is **server** or the user declines, skip to Step 3.
+**XiaoHongShu** — export from https://www.xiaohongshu.com :
+```bash
+agent-eyes configure xhs-cookie "PASTED_COOKIE_STRING"
+```
-### Step 3: Offer search upgrade
+**Bilibili** — export from https://www.bilibili.com :
+(On local computers Bilibili already works without cookies. On servers it needs a proxy — see Step 4.)
-> "Want to unlock web search? One free API key lets me search the entire web, Reddit, and Twitter.
-> → Go to https://exa.ai → sign up (free) → send me the API key.
-> Or say 'skip'."
+### Step 3: Set up search
+
+> "Want to unlock web search? One free API key lets me search the web, Reddit, and Twitter.
+> Go to https://exa.ai → sign up (free, 1000 searches/month) → send me the key.
+> Or say 'skip' — everything else still works."
-If user provides key:
```bash
agent-eyes configure exa-key THE_KEY
```
-### Step 4: Server-only — offer proxy
+### Step 4: Server-only — proxy for Reddit/Bilibili
-Only if auto-detected as server:
+Only mention if environment was detected as server:
-> "Reddit and Bilibili block server IPs. Reddit search still works free via Exa, but for full access you'd need a cheap proxy ($1/month).
-> → Get one at https://webshare.io if interested. Or skip — search still works!"
+> "On servers, Reddit and Bilibili block direct access. Reddit *search* still works via Exa (free), but for reading full Reddit posts or using Bilibili, you'd need a residential proxy (~$1/month).
+> Get one at https://webshare.io if you want. Or skip — not required."
-If user provides proxy:
```bash
agent-eyes configure proxy http://user:pass@ip:port
```
@@ -72,24 +96,22 @@ agent-eyes configure proxy http://user:pass@ip:port
agent-eyes doctor
```
-> "✅ All set! [list what's active]. Try asking me to search or read something!"
+> "✅ All set! [list active channels]. Try: 'search Reddit for ...' or 'read this URL'"
-**Users can always configure more later** by saying things like "set up Twitter for Agent Eyes" or "add my XiaoHongShu cookies".
+Users can configure more channels anytime — just say "set up Twitter" or "add proxy".
---
-## Manual configure (one channel at a time)
-
-These commands are for manual setup or adding individual channels later:
+## Quick Reference
| Command | What it does |
|---------|-------------|
-| `agent-eyes configure --from-browser chrome` | Import ALL cookies at once |
+| `agent-eyes configure --from-browser chrome` | Auto-import ALL cookies at once (local only) |
| `agent-eyes configure exa-key KEY` | Unlock search (web + Reddit + Twitter) |
-| `agent-eyes configure twitter-cookies TOKEN CT0` | Twitter deep search (manual) |
-| `agent-eyes configure xhs-cookie COOKIE` | XiaoHongShu (manual) |
-| `agent-eyes configure youtube-cookies chrome` | Age-restricted YouTube |
-| `agent-eyes configure proxy URL` | Reddit + Bilibili on servers |
-| `agent-eyes doctor` | Show all channels and status |
+| `agent-eyes configure twitter-cookies "COOKIE_STRING"` | Unlock Twitter (cookie string or auth_token + ct0) |
+| `agent-eyes configure xhs-cookie "COOKIE_STRING"` | Unlock XiaoHongShu |
+| `agent-eyes configure youtube-cookies chrome` | Unlock age-restricted YouTube |
+| `agent-eyes configure proxy URL` | Unlock Reddit reader + Bilibili (server) |
+| `agent-eyes doctor` | Show all channels and their status |
| `agent-eyes read URL` | Read any URL |
| `agent-eyes search "query"` | Search the web |