Document env-based X auth flow
Update README, launch copy, and UI guidance to prefer popup-free AUTH_TOKEN/CT0 configuration, and keep X backend selection on the verified Bird or xAI paths. Validation: uv run python -m unittest tests.test_env_project
This commit is contained in:
+11
-16
@@ -9,7 +9,7 @@ User: /last30days "kanye west"
|
||||
↓ ↓ (concurrent via ThreadPoolExecutor)
|
||||
[REDDIT] [X/TWITTER]
|
||||
↓ ↓
|
||||
OpenAI Bird CLI or
|
||||
OpenAI Bundled Bird or
|
||||
API xAI API
|
||||
↓ ↓
|
||||
Parse Parse
|
||||
@@ -95,11 +95,11 @@ No API key needed. This returns the actual thread data:
|
||||
|
||||
X search has **two backends** — the skill auto-detects which to use.
|
||||
|
||||
### Priority: Bird CLI (free) → xAI API (paid)
|
||||
### Priority: Bundled Bird (env auth) → xAI API (paid)
|
||||
|
||||
```python
|
||||
if bird_installed and bird_authenticated:
|
||||
use Bird CLI # Free, uses your X login
|
||||
if node_available and AUTH_TOKEN and CT0:
|
||||
use bundled Bird # Free, popup-free, env-authenticated
|
||||
elif XAI_API_KEY:
|
||||
use xAI API # Paid, uses grok-4-1-fast
|
||||
else:
|
||||
@@ -128,20 +128,15 @@ The prompt asks grok to return JSON with:
|
||||
- `engagement`: `{ likes, reposts, replies, quotes }`
|
||||
- `why_relevant`, `relevance` score
|
||||
|
||||
**Engagement data comes from grok's x_search tool** — it has direct access to X's data.
|
||||
**Engagement data comes from grok's x_search tool** - it has direct access to X's data.
|
||||
|
||||
### Backend 2: Bird CLI (free alternative)
|
||||
### Backend 2: Bundled Bird client (free alternative)
|
||||
|
||||
Bird is a CLI tool (`npm install -g @steipete/bird`) that uses your X login.
|
||||
The repo vendors a search-only subset of Bird's Twitter GraphQL client and shells out to it with Node.js. No global `bird` install is required. The Python wrapper passes `AUTH_TOKEN` and `CT0` via env, which keeps normal local runs headless and avoids browser-cookie prompts.
|
||||
|
||||
**Command:**
|
||||
```bash
|
||||
bird search "{topic} since:{from_date}" -n 30 --json
|
||||
```
|
||||
**Bundled Bird returns raw X API data** - likes, reposts, replies are real engagement metrics from X's API, not estimates.
|
||||
|
||||
**Bird returns raw X API data** — likes, reposts, replies are real engagement metrics from X's API, not estimates.
|
||||
|
||||
| Metric | Bird CLI | xAI API |
|
||||
| Metric | Bundled Bird | xAI API |
|
||||
|---|---|---|
|
||||
| Post text | Real | Real |
|
||||
| Likes/reposts | Real (X API) | Real (x_search tool) |
|
||||
@@ -151,7 +146,7 @@ bird search "{topic} since:{from_date}" -n 30 --json
|
||||
|
||||
### Depth settings
|
||||
|
||||
| Depth | xAI posts | Bird results | xAI timeout | Bird timeout |
|
||||
| Depth | xAI posts | Bundled Bird results | xAI timeout | Bird timeout |
|
||||
|---|---|---|---|---|
|
||||
| `--quick` | 8-12 | 12 | 90s | 30s |
|
||||
| default | 20-30 | 30 | 120s | 45s |
|
||||
@@ -192,7 +187,7 @@ After both searches complete:
|
||||
| `scripts/lib/openai_reddit.py` | Reddit search via OpenAI Responses API |
|
||||
| `scripts/lib/reddit_enrich.py` | Fetch real engagement data from Reddit JSON API |
|
||||
| `scripts/lib/xai_x.py` | X search via xAI API |
|
||||
| `scripts/lib/bird_x.py` | X search via Bird CLI (free) |
|
||||
| `scripts/lib/bird_x.py` | X search via bundled Bird client (free) |
|
||||
| `scripts/lib/models.py` | Auto-select best available model |
|
||||
| `scripts/lib/env.py` | API key loading, source detection |
|
||||
| `scripts/lib/http.py` | HTTP transport with retries |
|
||||
|
||||
+18
-20
@@ -13,7 +13,7 @@ YouTube transcripts are the second headline feature. Inspired by Peter Steinberg
|
||||
**New in V2.1 — two headline features:**
|
||||
|
||||
- **YouTube transcripts as a 4th source.** When yt-dlp is installed, /last30days automatically searches YouTube, grabs view counts, and extracts auto-generated transcripts from the top videos. A 20-minute review contains 10x the signal of a tweet — now the skill reads it. Inspired by @steipete's yt-dlp + summarize toolchain.
|
||||
- **X search is fully bundled.** No external `bird` CLI or xAI API key needed. Just Node.js 22+ and your browser cookies. Uses a vendored subset of Bird's Twitter GraphQL client (MIT licensed, originally by @steipete).
|
||||
- **X search is fully bundled.** No external `bird` CLI install needed. Add `AUTH_TOKEN` and `CT0` once, and the vendored Bird client runs locally without browser-cookie prompts. `XAI_API_KEY` remains an optional fallback.
|
||||
|
||||
---
|
||||
|
||||
@@ -21,20 +21,18 @@ YouTube transcripts are the second headline feature. Inspired by Peter Steinberg
|
||||
|
||||
### X Search Authentication
|
||||
|
||||
X search reads your existing browser cookies — no API keys or login commands needed.
|
||||
X search prefers explicit env auth. This keeps local runs headless and avoids browser-cookie and macOS Keychain prompts.
|
||||
|
||||
**Safari (recommended on Mac):** Just be logged into x.com. No setup needed.
|
||||
**Recommended setup:** While logged into x.com once, open browser dev tools and copy the `auth_token` and `ct0` cookies for `x.com`.
|
||||
|
||||
**Chrome:** Works, but macOS will prompt you to allow Keychain access the first time. Click "Allow" (or "Always Allow" to stop future prompts).
|
||||
|
||||
**Firefox:** Just be logged into x.com. No setup needed.
|
||||
|
||||
**Manual fallback:** If cookie auto-detection doesn't work, set these env vars (grab them from your browser's dev tools → Application → Cookies → x.com):
|
||||
Save them as `AUTH_TOKEN` and `CT0` in `~/.config/last30days/.env` or `.claude/last30days.env`:
|
||||
```bash
|
||||
export AUTH_TOKEN=your_auth_token
|
||||
export CT0=your_ct0_token
|
||||
AUTH_TOKEN=your_auth_token
|
||||
CT0=your_ct0_token
|
||||
```
|
||||
|
||||
**xAI fallback:** If you do not want to provide `AUTH_TOKEN` and `CT0`, set `XAI_API_KEY` and use xAI's `x_search` backend instead.
|
||||
|
||||
**Verify it's working:**
|
||||
```bash
|
||||
node ~/.claude/skills/last30days/scripts/lib/vendor/bird-search/bird-search.mjs --whoami
|
||||
@@ -44,8 +42,10 @@ node ~/.claude/skills/last30days/scripts/lib/vendor/bird-search/bird-search.mjs
|
||||
|
||||
## README: Install block env line
|
||||
|
||||
```
|
||||
XAI_API_KEY=xai-... # optional — cookie auth is default for X search
|
||||
```bash
|
||||
AUTH_TOKEN=... # recommended for X search
|
||||
CT0=... # recommended for X search
|
||||
XAI_API_KEY=xai-... # optional X fallback
|
||||
```
|
||||
|
||||
---
|
||||
@@ -60,15 +60,13 @@ XAI_API_KEY=xai-... # optional — cookie auth is default for X search
|
||||
|
||||
## GitHub issue #19 response (post AFTER publishing)
|
||||
|
||||
> Thanks for reporting this. Bird CLI was deprecated and the GitHub repo was deleted — steipete was asked to take it down.
|
||||
> Thanks for reporting this. Bird CLI was deprecated and the GitHub repo was deleted. steipete was asked to take it down.
|
||||
>
|
||||
> The good news: you don't need Bird anymore. v2.1 (just shipped) bundles X search directly — no external CLI, no `npm install`, no brew. Just Node.js 22+ and your browser cookies.
|
||||
> The good news: you don't need Bird anymore. v2.1 (just shipped) bundles X search directly. No external CLI, no `npm install`, no brew. Just Node.js 22+ plus `AUTH_TOKEN` and `CT0`, or `XAI_API_KEY` as fallback.
|
||||
>
|
||||
> It also adds **YouTube as a 4th source** — when yt-dlp is installed, the skill automatically searches YouTube and extracts transcripts from the top videos. A 20-minute tutorial has 10x the signal of a tweet, and now the synthesis engine reads it.
|
||||
> It also adds **YouTube as a 4th source**. When yt-dlp is installed, the skill automatically searches YouTube and extracts transcripts from the top videos. A 20-minute tutorial has 10x the signal of a tweet, and now the synthesis engine reads it.
|
||||
>
|
||||
> If you're on a Mac, Safari is the easiest path for X — just be logged into x.com. Chrome works too but macOS will prompt for Keychain access the first time.
|
||||
>
|
||||
> If cookie auto-detection doesn't work, you can set `AUTH_TOKEN` and `CT0` env vars manually (grab from browser dev tools → Application → Cookies → x.com).
|
||||
> The recommended setup is to copy `auth_token` and `ct0` from x.com once and store them as `AUTH_TOKEN` and `CT0` in your env. That avoids browser-cookie and Keychain prompts during normal runs.
|
||||
>
|
||||
> The xAI API (`XAI_API_KEY`) also still works as a fallback.
|
||||
|
||||
@@ -82,7 +80,7 @@ XAI_API_KEY=xai-... # optional — cookie auth is default for X search
|
||||
|
||||
Two new features:
|
||||
→ YouTube transcripts as a 4th source (yt-dlp)
|
||||
→ X search fully bundled (no bird CLI needed)
|
||||
→ X search fully bundled (no bird CLI install needed)
|
||||
|
||||
Research any topic across Reddit, X, YouTube & web in one command.
|
||||
|
||||
@@ -100,7 +98,7 @@ When yt-dlp is installed, the skill searches YouTube, grabs view counts, and ext
|
||||
### Thread version (post 2)
|
||||
|
||||
2️⃣ X search is fully bundled
|
||||
Bird CLI was deprecated. Instead of requiring an external tool, v2.1 vendors a search-only subset. Just be logged into x.com in your browser. No npm install, no API keys.
|
||||
Bird CLI was deprecated. Instead of requiring an external tool, v2.1 vendors a search-only subset. Add `AUTH_TOKEN` and `CT0` once, then it runs locally with no npm install. `XAI_API_KEY` still works as fallback.
|
||||
|
||||
Both features inspired by @steipete's tooling.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user