@antcoder/birdxtwittercli 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +176 -0
- package/LICENSE +21 -0
- package/README.md +388 -0
- package/dist/cli/pagination.d.ts +35 -0
- package/dist/cli/pagination.d.ts.map +1 -0
- package/dist/cli/pagination.js +43 -0
- package/dist/cli/pagination.js.map +1 -0
- package/dist/cli/program.d.ts +5 -0
- package/dist/cli/program.d.ts.map +1 -0
- package/dist/cli/program.js +113 -0
- package/dist/cli/program.js.map +1 -0
- package/dist/cli/shared.d.ts +77 -0
- package/dist/cli/shared.d.ts.map +1 -0
- package/dist/cli/shared.js +327 -0
- package/dist/cli/shared.js.map +1 -0
- package/dist/cli.d.ts +12 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +29 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/bookmarks.d.ts +4 -0
- package/dist/commands/bookmarks.d.ts.map +1 -0
- package/dist/commands/bookmarks.js +189 -0
- package/dist/commands/bookmarks.js.map +1 -0
- package/dist/commands/check.d.ts +4 -0
- package/dist/commands/check.d.ts.map +1 -0
- package/dist/commands/check.js +43 -0
- package/dist/commands/check.js.map +1 -0
- package/dist/commands/follow.d.ts +4 -0
- package/dist/commands/follow.d.ts.map +1 -0
- package/dist/commands/follow.js +91 -0
- package/dist/commands/follow.js.map +1 -0
- package/dist/commands/help.d.ts +4 -0
- package/dist/commands/help.d.ts.map +1 -0
- package/dist/commands/help.js +19 -0
- package/dist/commands/help.js.map +1 -0
- package/dist/commands/home.d.ts +4 -0
- package/dist/commands/home.d.ts.map +1 -0
- package/dist/commands/home.js +43 -0
- package/dist/commands/home.js.map +1 -0
- package/dist/commands/lists.d.ts +4 -0
- package/dist/commands/lists.d.ts.map +1 -0
- package/dist/commands/lists.js +213 -0
- package/dist/commands/lists.js.map +1 -0
- package/dist/commands/news.d.ts +4 -0
- package/dist/commands/news.d.ts.map +1 -0
- package/dist/commands/news.js +131 -0
- package/dist/commands/news.js.map +1 -0
- package/dist/commands/post.d.ts +4 -0
- package/dist/commands/post.d.ts.map +1 -0
- package/dist/commands/post.js +101 -0
- package/dist/commands/post.js.map +1 -0
- package/dist/commands/query-ids.d.ts +4 -0
- package/dist/commands/query-ids.d.ts.map +1 -0
- package/dist/commands/query-ids.js +80 -0
- package/dist/commands/query-ids.js.map +1 -0
- package/dist/commands/read.d.ts +4 -0
- package/dist/commands/read.d.ts.map +1 -0
- package/dist/commands/read.js +152 -0
- package/dist/commands/read.js.map +1 -0
- package/dist/commands/search.d.ts +4 -0
- package/dist/commands/search.d.ts.map +1 -0
- package/dist/commands/search.js +115 -0
- package/dist/commands/search.js.map +1 -0
- package/dist/commands/unbookmark.d.ts +4 -0
- package/dist/commands/unbookmark.d.ts.map +1 -0
- package/dist/commands/unbookmark.js +36 -0
- package/dist/commands/unbookmark.js.map +1 -0
- package/dist/commands/user-tweets.d.ts +4 -0
- package/dist/commands/user-tweets.d.ts.map +1 -0
- package/dist/commands/user-tweets.js +109 -0
- package/dist/commands/user-tweets.js.map +1 -0
- package/dist/commands/users.d.ts +4 -0
- package/dist/commands/users.d.ts.map +1 -0
- package/dist/commands/users.js +295 -0
- package/dist/commands/users.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/cli-args.d.ts +7 -0
- package/dist/lib/cli-args.d.ts.map +1 -0
- package/dist/lib/cli-args.js +25 -0
- package/dist/lib/cli-args.js.map +1 -0
- package/dist/lib/cookies.d.ts +31 -0
- package/dist/lib/cookies.d.ts.map +1 -0
- package/dist/lib/cookies.js +173 -0
- package/dist/lib/cookies.js.map +1 -0
- package/dist/lib/extract-bookmark-folder-id.d.ts +2 -0
- package/dist/lib/extract-bookmark-folder-id.d.ts.map +1 -0
- package/dist/lib/extract-bookmark-folder-id.js +20 -0
- package/dist/lib/extract-bookmark-folder-id.js.map +1 -0
- package/dist/lib/extract-list-id.d.ts +2 -0
- package/dist/lib/extract-list-id.d.ts.map +1 -0
- package/dist/lib/extract-list-id.js +19 -0
- package/dist/lib/extract-list-id.js.map +1 -0
- package/dist/lib/extract-tweet-id.d.ts +2 -0
- package/dist/lib/extract-tweet-id.d.ts.map +1 -0
- package/dist/lib/extract-tweet-id.js +14 -0
- package/dist/lib/extract-tweet-id.js.map +1 -0
- package/dist/lib/features.json +17 -0
- package/dist/lib/index.d.ts +10 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +4 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/normalize-handle.d.ts +6 -0
- package/dist/lib/normalize-handle.d.ts.map +1 -0
- package/dist/lib/normalize-handle.js +31 -0
- package/dist/lib/normalize-handle.js.map +1 -0
- package/dist/lib/output.d.ts +29 -0
- package/dist/lib/output.d.ts.map +1 -0
- package/dist/lib/output.js +88 -0
- package/dist/lib/output.js.map +1 -0
- package/dist/lib/paginate-cursor.d.ts +27 -0
- package/dist/lib/paginate-cursor.d.ts.map +1 -0
- package/dist/lib/paginate-cursor.js +37 -0
- package/dist/lib/paginate-cursor.js.map +1 -0
- package/dist/lib/query-ids.json +20 -0
- package/dist/lib/runtime-features.d.ts +19 -0
- package/dist/lib/runtime-features.d.ts.map +1 -0
- package/dist/lib/runtime-features.js +151 -0
- package/dist/lib/runtime-features.js.map +1 -0
- package/dist/lib/runtime-query-ids.d.ts +33 -0
- package/dist/lib/runtime-query-ids.d.ts.map +1 -0
- package/dist/lib/runtime-query-ids.js +264 -0
- package/dist/lib/runtime-query-ids.js.map +1 -0
- package/dist/lib/thread-filters.d.ts +8 -0
- package/dist/lib/thread-filters.d.ts.map +1 -0
- package/dist/lib/thread-filters.js +124 -0
- package/dist/lib/thread-filters.js.map +1 -0
- package/dist/lib/twitter-client-base.d.ts +38 -0
- package/dist/lib/twitter-client-base.d.ts.map +1 -0
- package/dist/lib/twitter-client-base.js +129 -0
- package/dist/lib/twitter-client-base.js.map +1 -0
- package/dist/lib/twitter-client-bookmarks.d.ts +7 -0
- package/dist/lib/twitter-client-bookmarks.d.ts.map +1 -0
- package/dist/lib/twitter-client-bookmarks.js +61 -0
- package/dist/lib/twitter-client-bookmarks.js.map +1 -0
- package/dist/lib/twitter-client-constants.d.ts +44 -0
- package/dist/lib/twitter-client-constants.d.ts.map +1 -0
- package/dist/lib/twitter-client-constants.js +51 -0
- package/dist/lib/twitter-client-constants.js.map +1 -0
- package/dist/lib/twitter-client-engagement.d.ts +16 -0
- package/dist/lib/twitter-client-engagement.d.ts.map +1 -0
- package/dist/lib/twitter-client-engagement.js +81 -0
- package/dist/lib/twitter-client-engagement.js.map +1 -0
- package/dist/lib/twitter-client-features.d.ts +14 -0
- package/dist/lib/twitter-client-features.d.ts.map +1 -0
- package/dist/lib/twitter-client-features.js +347 -0
- package/dist/lib/twitter-client-features.js.map +1 -0
- package/dist/lib/twitter-client-follow.d.ts +8 -0
- package/dist/lib/twitter-client-follow.d.ts.map +1 -0
- package/dist/lib/twitter-client-follow.js +178 -0
- package/dist/lib/twitter-client-follow.js.map +1 -0
- package/dist/lib/twitter-client-home.d.ts +13 -0
- package/dist/lib/twitter-client-home.d.ts.map +1 -0
- package/dist/lib/twitter-client-home.js +138 -0
- package/dist/lib/twitter-client-home.js.map +1 -0
- package/dist/lib/twitter-client-lists.d.ts +12 -0
- package/dist/lib/twitter-client-lists.d.ts.map +1 -0
- package/dist/lib/twitter-client-lists.js +390 -0
- package/dist/lib/twitter-client-lists.js.map +1 -0
- package/dist/lib/twitter-client-media.d.ts +11 -0
- package/dist/lib/twitter-client-media.d.ts.map +1 -0
- package/dist/lib/twitter-client-media.js +136 -0
- package/dist/lib/twitter-client-media.js.map +1 -0
- package/dist/lib/twitter-client-news.d.ts +47 -0
- package/dist/lib/twitter-client-news.d.ts.map +1 -0
- package/dist/lib/twitter-client-news.js +283 -0
- package/dist/lib/twitter-client-news.js.map +1 -0
- package/dist/lib/twitter-client-posting.d.ts +8 -0
- package/dist/lib/twitter-client-posting.d.ts.map +1 -0
- package/dist/lib/twitter-client-posting.js +218 -0
- package/dist/lib/twitter-client-posting.js.map +1 -0
- package/dist/lib/twitter-client-search.d.ts +19 -0
- package/dist/lib/twitter-client-search.d.ts.map +1 -0
- package/dist/lib/twitter-client-search.js +157 -0
- package/dist/lib/twitter-client-search.js.map +1 -0
- package/dist/lib/twitter-client-timelines.d.ts +23 -0
- package/dist/lib/twitter-client-timelines.d.ts.map +1 -0
- package/dist/lib/twitter-client-timelines.js +471 -0
- package/dist/lib/twitter-client-timelines.js.map +1 -0
- package/dist/lib/twitter-client-tweet-detail.d.ts +25 -0
- package/dist/lib/twitter-client-tweet-detail.d.ts.map +1 -0
- package/dist/lib/twitter-client-tweet-detail.js +295 -0
- package/dist/lib/twitter-client-tweet-detail.js.map +1 -0
- package/dist/lib/twitter-client-types.d.ts +407 -0
- package/dist/lib/twitter-client-types.d.ts.map +1 -0
- package/dist/lib/twitter-client-types.js +2 -0
- package/dist/lib/twitter-client-types.js.map +1 -0
- package/dist/lib/twitter-client-user-lookup.d.ts +16 -0
- package/dist/lib/twitter-client-user-lookup.d.ts.map +1 -0
- package/dist/lib/twitter-client-user-lookup.js +224 -0
- package/dist/lib/twitter-client-user-lookup.js.map +1 -0
- package/dist/lib/twitter-client-user-tweets.d.ts +22 -0
- package/dist/lib/twitter-client-user-tweets.d.ts.map +1 -0
- package/dist/lib/twitter-client-user-tweets.js +154 -0
- package/dist/lib/twitter-client-user-tweets.js.map +1 -0
- package/dist/lib/twitter-client-users.d.ts +9 -0
- package/dist/lib/twitter-client-users.d.ts.map +1 -0
- package/dist/lib/twitter-client-users.js +358 -0
- package/dist/lib/twitter-client-users.js.map +1 -0
- package/dist/lib/twitter-client-utils.d.ts +173 -0
- package/dist/lib/twitter-client-utils.d.ts.map +1 -0
- package/dist/lib/twitter-client-utils.js +511 -0
- package/dist/lib/twitter-client-utils.js.map +1 -0
- package/dist/lib/twitter-client.d.ts +23 -0
- package/dist/lib/twitter-client.d.ts.map +1 -0
- package/dist/lib/twitter-client.js +21 -0
- package/dist/lib/twitter-client.js.map +1 -0
- package/dist/lib/version.d.ts +6 -0
- package/dist/lib/version.d.ts.map +1 -0
- package/dist/lib/version.js +174 -0
- package/dist/lib/version.js.map +1 -0
- package/package.json +61 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.8.0 — 2026-01-19
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- `bookmarks` thread expansion controls (`--expand-root-only`, `--author-chain`, `--author-only`, `--full-chain-only`, `--include-ancestor-branches`, `--include-parent`, `--thread-meta`, `--sort-chronological`) for richer context exports (#55) — thanks @kkretschmer2.
|
|
7
|
+
- `--chrome-profile-dir` to point at Chromium profile directories or cookie DB files (Arc/Brave/etc) for cookie extraction (#16) — thanks @tekumara.
|
|
8
|
+
- `about` command to report account origin/location metadata (#51) — thanks @pjtf93.
|
|
9
|
+
- `follow`/`unfollow` commands to manage follows (#54) — thanks @citizenlee.
|
|
10
|
+
- Twitter client now supports like/unlike/retweet/unretweet/bookmark via the engagement mixin (#53) — thanks @the-vampiire.
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
- `bookmarks` expanded JSON now preserves pagination `nextCursor`, and full-chain filtering only includes ancestor branches when requested.
|
|
14
|
+
- Follow/unfollow REST fallback now supports cursor pagination for followers/following (#54).
|
|
15
|
+
- About account live coverage now verifies data extraction paths (#51) — thanks @pjtf93.
|
|
16
|
+
|
|
17
|
+
### Tests
|
|
18
|
+
- Live tests now exercise engagement mutations (opt-in) (#53) — thanks @the-vampiire.
|
|
19
|
+
|
|
20
|
+
## 0.7.0 — 2026-01-12
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
- `home` command for the "For You" and "Following" home timelines (#31) — thanks @odysseus0.
|
|
24
|
+
- `news`/`trending` command for Explore tabs with AI-curated headlines (#39) — thanks @aavetis.
|
|
25
|
+
- `user-tweets` command to fetch a user's profile timeline (#34) — thanks @crcatala.
|
|
26
|
+
- `replies` and `thread` now support pagination (`--all`, `--max-pages`, `--cursor`, `--delay`) (#35) — thanks @crcatala.
|
|
27
|
+
- `search` now supports pagination (`--all`, `--max-pages`, `--cursor`) (#42) — thanks @pjtf93.
|
|
28
|
+
- `likes` now supports pagination (`--all`, `--max-pages`, `--cursor`) (#44) — thanks @jsholmes.
|
|
29
|
+
- `list-timeline` now supports pagination (`--all`, `--max-pages`, `--cursor`) (#30) — thanks @zheli.
|
|
30
|
+
- Rich text output now shows article previews, quoted tweets, and media links (#32) — thanks @odysseus0.
|
|
31
|
+
- Long-form article tweets now render rich Draft.js content blocks/entities (#36) — thanks @crcatala.
|
|
32
|
+
|
|
33
|
+
### Changed
|
|
34
|
+
- Library typing: `SearchResult` is now a discriminated union (so `error` only exists when `success: false`).
|
|
35
|
+
|
|
36
|
+
### Fixed
|
|
37
|
+
- Lists GraphQL feature flags updated to prevent 400s (#27) — thanks @zheli.
|
|
38
|
+
- Lists feature overrides now scope new GraphQL flags correctly (#50) — thanks @ryanh-ai.
|
|
39
|
+
- Tweet detail parsing now tolerates partial GraphQL errors when usable data exists (#48) — thanks @jsholmes.
|
|
40
|
+
- News output now respects `--tweets-per-item`, keeps unique IDs, and parses non-add entry instructions (#39) — thanks @aavetis.
|
|
41
|
+
- Following/followers pagination now guards repeat cursors and standardizes JSON output (#28) — thanks @malpern.
|
|
42
|
+
- Likes pagination now follows cursors and avoids stalling on duplicate pages (#12) — thanks @titouv.
|
|
43
|
+
- macOS cookie extraction now supports Brave keychain storage (#40) — thanks @gakonst.
|
|
44
|
+
- Terminal hyperlinks now sanitize control characters before emitting OSC 8 sequences (#29) — thanks @mafulafunk.
|
|
45
|
+
- `pnpm run build:dist` now succeeds after tightening JSON/pagination option typing in tweet output commands.
|
|
46
|
+
|
|
47
|
+
### Tests
|
|
48
|
+
- Following: split following/likes tests + cover cursor handling (#33) — thanks @VACInc.
|
|
49
|
+
|
|
50
|
+
## 0.6.0 — 2026-01-05
|
|
51
|
+
|
|
52
|
+
### Added
|
|
53
|
+
- Bookmark exports now support pagination (`--all`, `--max-pages`) with retries (#15) — thanks @Nano1337.
|
|
54
|
+
- `lists` + `list-timeline` commands for Twitter Lists (#21) — thanks @harperreed
|
|
55
|
+
- Tweet JSON output now includes media items (photos, videos, GIFs) (#14) — thanks @Hormold
|
|
56
|
+
- Bookmarks can resume pagination from a cursor (#26) — thanks @leonho
|
|
57
|
+
- `unbookmark` command to remove bookmarked tweets (#22) — thanks @mbelinky.
|
|
58
|
+
|
|
59
|
+
### Changed
|
|
60
|
+
- Feature flags can be overridden at runtime via `features.json` (refreshable via `query-ids`).
|
|
61
|
+
|
|
62
|
+
### Fixed
|
|
63
|
+
- GraphQL feature flags now include `post_ctas_fetch_enabled` to avoid 400s (#38) — thanks @philipp-spiess.
|
|
64
|
+
|
|
65
|
+
## 0.5.1 — 2026-01-01
|
|
66
|
+
|
|
67
|
+
### Changed
|
|
68
|
+
- `bird --help` now includes explicit “Shortcuts” and “JSON Output” sections (documents `bird <tweet-id-or-url>` shorthand + `--json`).
|
|
69
|
+
- Release docs now include explicit npm publish verification steps.
|
|
70
|
+
|
|
71
|
+
### Fixed
|
|
72
|
+
- `pnpm bird --help` now works (dev script runs the CLI entrypoint, not the library entrypoint).
|
|
73
|
+
- `following`/`followers` now fall back to internal v1.1 REST endpoints when GraphQL returns `404`.
|
|
74
|
+
|
|
75
|
+
### Tests
|
|
76
|
+
- Add root help output regression test.
|
|
77
|
+
- Add opt-in live CLI test suite (real GraphQL calls; skipped by default; gated via `BIRD_LIVE=1`).
|
|
78
|
+
|
|
79
|
+
## 0.5.0 — 2026-01-01
|
|
80
|
+
|
|
81
|
+
### Added
|
|
82
|
+
- `likes` command to list your liked tweets (thanks @swairshah).
|
|
83
|
+
- Quoted tweet data in JSON output + `--quote-depth` (thanks @alexknowshtml).
|
|
84
|
+
- `following`/`followers` commands to list users (thanks @lockmeister).
|
|
85
|
+
|
|
86
|
+
### Changed
|
|
87
|
+
- Query ID updater now tracks the Likes GraphQL operation.
|
|
88
|
+
- Query ID updater now tracks Following/Followers GraphQL operations.
|
|
89
|
+
- Query ID updater now tracks BookmarkFolderTimeline and keeps bookmark query IDs seeded.
|
|
90
|
+
- `following`/`followers` JSON user fields are now camelCase (`followersCount`, `followingCount`, `isBlueVerified`, `profileImageUrl`, `createdAt`).
|
|
91
|
+
- Cookie extraction timeout is now configurable (default 30s on macOS) via `--cookie-timeout` / `BIRD_COOKIE_TIMEOUT_MS` (thanks @tylerseymour).
|
|
92
|
+
- Search now paginates beyond 20 results when using `-n` (thanks @ryanh-ai).
|
|
93
|
+
- Library exports are now separated from the CLI entrypoint for easier embedding.
|
|
94
|
+
|
|
95
|
+
## 0.4.1 — 2025-12-31
|
|
96
|
+
|
|
97
|
+
### Added
|
|
98
|
+
- `bookmarks` command to list your bookmarked tweets.
|
|
99
|
+
- `bookmarks --folder-id` to fetch bookmark folders (thanks @tylerseymour).
|
|
100
|
+
|
|
101
|
+
### Changed
|
|
102
|
+
- Cookie extraction now uses `@steipete/sweet-cookie` (drops `sqlite3` CLI + custom browser readers in `bird`).
|
|
103
|
+
- Query ID updater now tracks the Bookmarks GraphQL operation.
|
|
104
|
+
- Lint rules stricter (block statements, no-negation-else, useConst/useTemplate, top-level regex, import extension enforcement).
|
|
105
|
+
- `pnpm lint` now runs both Biome and oxlint (type-aware).
|
|
106
|
+
|
|
107
|
+
### Tests
|
|
108
|
+
- Coverage thresholds raised to 90% statements/lines/functions (80% branches).
|
|
109
|
+
- Added targeted Twitter client coverage suites.
|
|
110
|
+
|
|
111
|
+
## 0.4.0 — 2025-12-26
|
|
112
|
+
|
|
113
|
+
### Added
|
|
114
|
+
- Cookie source selection: `--cookie-source safari|chrome|firefox` (repeatable) + `cookieSource` config (string or array).
|
|
115
|
+
|
|
116
|
+
### Fixed
|
|
117
|
+
- `tweet`/`reply`: fallback to `statuses/update.json` when GraphQL `CreateTweet` returns error 226 (“automated request”).
|
|
118
|
+
|
|
119
|
+
### Breaking
|
|
120
|
+
- Remove `allowSafari`/`allowChrome`/`allowFirefox` config toggles in favor of `cookieSource` ordering.
|
|
121
|
+
|
|
122
|
+
## 0.3.0 — 2025-12-26
|
|
123
|
+
|
|
124
|
+
### Added
|
|
125
|
+
- Safari cookie extraction (`Cookies.binarycookies`) + `allowSafari` config toggle.
|
|
126
|
+
|
|
127
|
+
### Changed
|
|
128
|
+
- Removed the Sweetistics engine + fallback. `bird` is GraphQL-only.
|
|
129
|
+
- Browser cookie fallback order: Safari → Chrome → Firefox.
|
|
130
|
+
|
|
131
|
+
### Tests
|
|
132
|
+
- Enforce coverage thresholds (>= 70% statements/branches/functions/lines) + expand unit coverage for version/output/Twitter client branches.
|
|
133
|
+
|
|
134
|
+
## 0.2.0 — 2025-12-26
|
|
135
|
+
|
|
136
|
+
### Added
|
|
137
|
+
- Output controls: `--plain`, `--no-emoji`, `--no-color` (respects `NO_COLOR`).
|
|
138
|
+
- `help` command: `bird help <command>`.
|
|
139
|
+
- Runtime GraphQL query ID refresh: `bird query-ids --fresh` (cached on disk; auto-retry on 404; override cache via `BIRD_QUERY_IDS_CACHE`).
|
|
140
|
+
- GraphQL media uploads via `--media` (up to 4 images/GIFs, or 1 video).
|
|
141
|
+
|
|
142
|
+
### Fixed
|
|
143
|
+
- CLI `--version`: read version from `package.json`/`VERSION` (no hardcoded string) + append git sha when available.
|
|
144
|
+
|
|
145
|
+
### Changed
|
|
146
|
+
- `mentions`: no hardcoded user; defaults to authenticated user or accepts `--user @handle`.
|
|
147
|
+
- GraphQL query ID updater: correctly pairs `operationName` ↔ `queryId` (CreateTweet/CreateRetweet/etc).
|
|
148
|
+
- `build:dist`: copies `src/lib/query-ids.json` into `dist/lib/query-ids.json` (keeps `dist/` in sync).
|
|
149
|
+
- `--engine graphql`: strict GraphQL-only (disables Sweetistics fallback).
|
|
150
|
+
|
|
151
|
+
## 0.1.1 — 2025-12-26
|
|
152
|
+
|
|
153
|
+
### Changed
|
|
154
|
+
- Engine default now `auto` (GraphQL primary; Sweetistics only on fallback when configured).
|
|
155
|
+
|
|
156
|
+
### Tests
|
|
157
|
+
- Add engine resolution tests for auto/default behavior.
|
|
158
|
+
|
|
159
|
+
### Fixed
|
|
160
|
+
- GraphQL read: rotate TweetDetail query IDs with fallback to avoid 404s.
|
|
161
|
+
|
|
162
|
+
## 0.1.0 — 2025-12-20
|
|
163
|
+
|
|
164
|
+
### Added
|
|
165
|
+
- CLI commands: `tweet`, `reply`, `read`, `replies`, `thread`, `search`, `mentions`, `whoami`, `check`.
|
|
166
|
+
- URL/ID shorthand for `read`, plus `--json` output where supported.
|
|
167
|
+
- GraphQL engine with cookie auth from Firefox/Chrome/env/flags (macOS browsers).
|
|
168
|
+
- Sweetistics engine (API key) with automatic fallback when configured.
|
|
169
|
+
- Media uploads via Sweetistics with per-item alt text (images or single video).
|
|
170
|
+
- Long-form Notes and Articles extraction for full text output.
|
|
171
|
+
- Thread + reply fetching with full conversation parsing.
|
|
172
|
+
- Search + mentions via GraphQL (latest timeline).
|
|
173
|
+
- JSON5 config files (`~/.config/bird/config.json5`, `./.birdrc.json5`) with engine defaults, profiles, allowChrome/allowFirefox, and timeoutMs.
|
|
174
|
+
- Request timeouts (`--timeout`, `timeoutMs`) for GraphQL and Sweetistics calls.
|
|
175
|
+
- Bun-compiled standalone binary via `pnpm run build`.
|
|
176
|
+
- Query ID refresh helper: `pnpm run graphql:update`.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Peter Steinberger
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
# bird 🐦 — fast X CLI for tweeting, replying, and reading
|
|
2
|
+
|
|
3
|
+
`bird` is a fast X CLI for tweeting, replying, and reading via X/Twitter GraphQL (cookie auth).
|
|
4
|
+
|
|
5
|
+
## Disclaimer
|
|
6
|
+
|
|
7
|
+
This project uses X/Twitter’s **undocumented** web GraphQL API (and cookie auth). X can change endpoints, query IDs,
|
|
8
|
+
and anti-bot behavior at any time — **expect this to break without notice**.
|
|
9
|
+
|
|
10
|
+
**Strong recommendation: Do not use bird to tweet. You will hit blocks very quickly. Use it to read tweets.
|
|
11
|
+
Bots are not welcome on X/Twitter. If you absolutely have to, use browser automation instead, or pay for the Twitter API to create tweets.**
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install -g @antcoder/birdxtwittercli
|
|
17
|
+
# or
|
|
18
|
+
pnpm add -g @antcoder/birdxtwittercli
|
|
19
|
+
# or
|
|
20
|
+
bun add -g @antcoder/birdxtwittercli
|
|
21
|
+
|
|
22
|
+
# one-shot (no install)
|
|
23
|
+
bunx @antcoder/birdxtwittercli whoami
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Homebrew (macOS, prebuilt Bun binary):
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# brew install coming soon
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Quickstart
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# Show the logged-in account
|
|
36
|
+
bird whoami
|
|
37
|
+
|
|
38
|
+
# Discover command help
|
|
39
|
+
bird help whoami
|
|
40
|
+
|
|
41
|
+
# Read a tweet (URL or ID)
|
|
42
|
+
bird read https://x.com/user/status/1234567890123456789
|
|
43
|
+
bird 1234567890123456789 --json
|
|
44
|
+
|
|
45
|
+
# Thread + replies
|
|
46
|
+
bird thread https://x.com/user/status/1234567890123456789
|
|
47
|
+
bird replies 1234567890123456789
|
|
48
|
+
bird replies 1234567890123456789 --max-pages 3 --json
|
|
49
|
+
bird thread 1234567890123456789 --max-pages 3 --json
|
|
50
|
+
|
|
51
|
+
# Search + mentions
|
|
52
|
+
bird search "from:steipete" -n 5
|
|
53
|
+
bird mentions -n 5
|
|
54
|
+
bird mentions --user @steipete -n 5
|
|
55
|
+
|
|
56
|
+
# User tweets (profile timeline)
|
|
57
|
+
bird user-tweets @steipete -n 20
|
|
58
|
+
bird user-tweets @steipete -n 50 --json
|
|
59
|
+
|
|
60
|
+
# Bookmarks
|
|
61
|
+
bird bookmarks -n 5
|
|
62
|
+
bird bookmarks --folder-id 123456789123456789 -n 5 # https://x.com/i/bookmarks/<folder-id>
|
|
63
|
+
bird bookmarks --all --json
|
|
64
|
+
bird bookmarks --all --max-pages 2 --json
|
|
65
|
+
bird bookmarks --include-parent --json
|
|
66
|
+
bird unbookmark 1234567890123456789
|
|
67
|
+
bird unbookmark https://x.com/user/status/1234567890123456789
|
|
68
|
+
|
|
69
|
+
# Likes
|
|
70
|
+
bird likes -n 5
|
|
71
|
+
|
|
72
|
+
# News and trending topics (AI-curated from Explore tabs)
|
|
73
|
+
bird news --ai-only -n 10
|
|
74
|
+
bird news --sports -n 5
|
|
75
|
+
|
|
76
|
+
# Lists
|
|
77
|
+
bird list-timeline 1234567890 -n 20
|
|
78
|
+
bird list-timeline https://x.com/i/lists/1234567890 --all --json
|
|
79
|
+
bird list-timeline 1234567890 --max-pages 3 --json
|
|
80
|
+
|
|
81
|
+
# Following (who you follow)
|
|
82
|
+
bird following -n 20
|
|
83
|
+
bird following --user 12345678 -n 10 # by user ID
|
|
84
|
+
|
|
85
|
+
# Followers (who follows you)
|
|
86
|
+
bird followers -n 20
|
|
87
|
+
bird followers --user 12345678 -n 10 # by user ID
|
|
88
|
+
|
|
89
|
+
# Refresh GraphQL query IDs cache (no rebuild)
|
|
90
|
+
bird query-ids --fresh
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## News & Trending
|
|
94
|
+
|
|
95
|
+
Fetch AI-curated news and trending topics from X's Explore page tabs:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
# Fetch 10 news items from all tabs (default: For You, News, Sports, Entertainment)
|
|
99
|
+
bird news -n 10
|
|
100
|
+
|
|
101
|
+
# Fetch only AI-curated news (filters out regular trends)
|
|
102
|
+
bird news --ai-only -n 20
|
|
103
|
+
|
|
104
|
+
# Fetch from specific tabs
|
|
105
|
+
bird news --news-only --ai-only -n 10
|
|
106
|
+
bird news --sports -n 15
|
|
107
|
+
bird news --entertainment --ai-only -n 5
|
|
108
|
+
|
|
109
|
+
# Include related tweets for each news item
|
|
110
|
+
bird news --with-tweets --tweets-per-item 3 -n 10
|
|
111
|
+
|
|
112
|
+
# Combine multiple tab filters
|
|
113
|
+
bird news --sports --entertainment -n 20
|
|
114
|
+
|
|
115
|
+
# JSON output
|
|
116
|
+
bird news --json -n 5
|
|
117
|
+
bird news --json-full --ai-only -n 10 # includes raw API response
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Tab options (can be combined):
|
|
121
|
+
- `--for-you` — Fetch from For You tab only
|
|
122
|
+
- `--news-only` — Fetch from News tab only
|
|
123
|
+
- `--sports` — Fetch from Sports tab only
|
|
124
|
+
- `--entertainment` — Fetch from Entertainment tab only
|
|
125
|
+
- `--trending-only` — Fetch from Trending tab only
|
|
126
|
+
|
|
127
|
+
By default, the command fetches from For You, News, Sports, and Entertainment tabs (Trending excluded to reduce noise). Headlines are automatically deduplicated across tabs.
|
|
128
|
+
|
|
129
|
+
## Library
|
|
130
|
+
|
|
131
|
+
`bird` can be used as a library (same GraphQL client as the CLI):
|
|
132
|
+
|
|
133
|
+
```ts
|
|
134
|
+
import { TwitterClient, resolveCredentials } from '@antcoder/birdxtwittercli';
|
|
135
|
+
|
|
136
|
+
const { cookies } = await resolveCredentials({ cookieSource: 'safari' });
|
|
137
|
+
const client = new TwitterClient({ cookies });
|
|
138
|
+
|
|
139
|
+
// Search for tweets
|
|
140
|
+
const searchResult = await client.search('from:steipete', 50);
|
|
141
|
+
|
|
142
|
+
// Fetch news and trending topics from all tabs (default: For You, News, Sports, Entertainment)
|
|
143
|
+
const newsResult = await client.getNews(10, { aiOnly: true });
|
|
144
|
+
|
|
145
|
+
// Fetch from specific tabs with related tweets
|
|
146
|
+
const sportsNews = await client.getNews(10, {
|
|
147
|
+
aiOnly: true,
|
|
148
|
+
withTweets: true,
|
|
149
|
+
tabs: ['sports', 'entertainment']
|
|
150
|
+
});
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Account details (About profile):
|
|
154
|
+
|
|
155
|
+
```ts
|
|
156
|
+
const aboutResult = await client.getUserAboutAccount('antcoder');
|
|
157
|
+
if (aboutResult.success && aboutResult.aboutProfile) {
|
|
158
|
+
console.log(aboutResult.aboutProfile.accountBasedIn);
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Fields:
|
|
163
|
+
- `accountBasedIn`
|
|
164
|
+
- `source`
|
|
165
|
+
- `createdCountryAccurate`
|
|
166
|
+
- `locationAccurate`
|
|
167
|
+
- `learnMoreUrl`
|
|
168
|
+
|
|
169
|
+
## Commands
|
|
170
|
+
|
|
171
|
+
- `bird tweet "<text>"` — post a new tweet.
|
|
172
|
+
- `bird reply <tweet-id-or-url> "<text>"` — reply to a tweet using its ID or URL.
|
|
173
|
+
- `bird help [command]` — show help (or help for a subcommand).
|
|
174
|
+
- `bird query-ids [--fresh] [--json]` — inspect or refresh cached GraphQL query IDs.
|
|
175
|
+
- `bird home [-n count] [--following] [--json] [--json-full]` — fetch your home timeline (For You) or Following feed.
|
|
176
|
+
- `bird read <tweet-id-or-url> [--json]` — fetch tweet content as text or JSON.
|
|
177
|
+
- `bird <tweet-id-or-url> [--json]` — shorthand for `read` when only a URL or ID is provided.
|
|
178
|
+
- `bird replies <tweet-id-or-url> [--all] [--max-pages n] [--cursor string] [--delay ms] [--json]` — list replies to a tweet.
|
|
179
|
+
- `bird thread <tweet-id-or-url> [--all] [--max-pages n] [--cursor string] [--delay ms] [--json]` — show the full conversation thread.
|
|
180
|
+
- `bird search "<query>" [-n count] [--all] [--max-pages n] [--cursor string] [--json]` — search for tweets matching a query; `--max-pages` requires `--all` or `--cursor`.
|
|
181
|
+
- `bird mentions [-n count] [--user @handle] [--json]` — find tweets mentioning a user (defaults to the authenticated user).
|
|
182
|
+
- `bird user-tweets <@handle> [-n count] [--cursor string] [--max-pages n] [--delay ms] [--json]` — get tweets from a user's profile timeline.
|
|
183
|
+
- `bird bookmarks [-n count] [--folder-id id] [--all] [--max-pages n] [--cursor string] [--expand-root-only] [--author-chain] [--author-only] [--full-chain-only] [--include-ancestor-branches] [--include-parent] [--thread-meta] [--sort-chronological] [--json]` — list your bookmarked tweets (or a specific bookmark folder); expansion flags control thread context; `--max-pages` requires `--all` or `--cursor`.
|
|
184
|
+
- `bird unbookmark <tweet-id-or-url...>` — remove one or more bookmarks by tweet ID or URL.
|
|
185
|
+
- `bird likes [-n count] [--all] [--max-pages n] [--cursor string] [--json] [--json-full]` — list your liked tweets; `--max-pages` requires `--all` or `--cursor`.
|
|
186
|
+
- `bird news [-n count] [--ai-only] [--with-tweets] [--tweets-per-item n] [--for-you] [--news-only] [--sports] [--entertainment] [--trending-only] [--json]` — fetch news and trending topics from X's Explore tabs.
|
|
187
|
+
- `bird trending` — alias for `news` command.
|
|
188
|
+
- `bird lists [--member-of] [-n count] [--json]` — list your lists (owned or memberships).
|
|
189
|
+
- `bird list-timeline <list-id-or-url> [-n count] [--all] [--max-pages n] [--cursor string] [--json]` — get tweets from a list timeline; `--max-pages` implies `--all`.
|
|
190
|
+
- `bird following [--user <userId>] [-n count] [--cursor string] [--all] [--max-pages n] [--json]` — list users that you (or another user) follow; `--max-pages` requires `--all`.
|
|
191
|
+
- `bird followers [--user <userId>] [-n count] [--cursor string] [--all] [--max-pages n] [--json]` — list users that follow you (or another user); `--max-pages` requires `--all`.
|
|
192
|
+
- `bird about <@handle> [--json]` — get account origin and location information for a user.
|
|
193
|
+
- `bird whoami` — print which Twitter account your cookies belong to.
|
|
194
|
+
- `bird check` — show which credentials are available and where they were sourced from.
|
|
195
|
+
|
|
196
|
+
Bookmarks flags:
|
|
197
|
+
- `--expand-root-only`: expand threads only when the bookmark is a root tweet.
|
|
198
|
+
- `--author-chain`: keep only the bookmarked author's connected self-reply chain.
|
|
199
|
+
- `--author-only`: include all tweets from the bookmarked author within the thread.
|
|
200
|
+
- `--full-chain-only`: keep the entire reply chain connected to the bookmarked tweet (all authors).
|
|
201
|
+
- `--include-ancestor-branches`: include sibling branches for ancestors when using `--full-chain-only`.
|
|
202
|
+
- `--include-parent`: include the direct parent tweet for non-root bookmarks.
|
|
203
|
+
- `--thread-meta`: add thread metadata fields to each tweet.
|
|
204
|
+
- `--sort-chronological`: sort output globally oldest to newest (default preserves bookmark order).
|
|
205
|
+
|
|
206
|
+
Global options:
|
|
207
|
+
- `--auth-token <token>`: set the `auth_token` cookie manually.
|
|
208
|
+
- `--ct0 <token>`: set the `ct0` cookie manually.
|
|
209
|
+
- `--cookie-source <safari|chrome|firefox>`: choose browser cookie source (repeatable; order matters).
|
|
210
|
+
- `--chrome-profile <name>`: Chrome profile name for cookie extraction (e.g., `Default`, `Profile 2`).
|
|
211
|
+
- `--chrome-profile-dir <path>`: Chrome/Chromium profile directory or cookie DB path for cookie extraction.
|
|
212
|
+
- `--firefox-profile <name>`: Firefox profile for cookie extraction.
|
|
213
|
+
- `--cookie-timeout <ms>`: cookie extraction timeout for keychain/OS helpers (milliseconds).
|
|
214
|
+
- `--timeout <ms>`: abort requests after the given timeout (milliseconds).
|
|
215
|
+
- `--quote-depth <n>`: max quoted tweet depth in JSON output (default: 1; 0 disables).
|
|
216
|
+
- `--plain`: stable output (no emoji, no color).
|
|
217
|
+
- `--no-emoji`: disable emoji output.
|
|
218
|
+
- `--no-color`: disable ANSI colors (or set `NO_COLOR=1`).
|
|
219
|
+
- `--media <path>`: attach media file (repeatable, up to 4 images or 1 video).
|
|
220
|
+
- `--alt <text>`: alt text for the corresponding `--media` (repeatable).
|
|
221
|
+
|
|
222
|
+
## Authentication (GraphQL)
|
|
223
|
+
|
|
224
|
+
GraphQL mode uses your existing X/Twitter web session (no password prompt). It sends requests to internal
|
|
225
|
+
X endpoints and authenticates via cookies (`auth_token`, `ct0`).
|
|
226
|
+
|
|
227
|
+
Write operations:
|
|
228
|
+
- `tweet`/`reply` primarily use GraphQL (`CreateTweet`).
|
|
229
|
+
- If GraphQL returns error `226` (“automated request”), `bird` falls back to the legacy `statuses/update.json` endpoint.
|
|
230
|
+
|
|
231
|
+
`bird` resolves credentials in this order:
|
|
232
|
+
|
|
233
|
+
1. CLI flags: `--auth-token`, `--ct0`
|
|
234
|
+
2. Environment variables: `AUTH_TOKEN`, `CT0` (fallback: `TWITTER_AUTH_TOKEN`, `TWITTER_CT0`)
|
|
235
|
+
3. Browser cookies via `@steipete/sweet-cookie` (override via `--cookie-source` order)
|
|
236
|
+
|
|
237
|
+
Browser cookie sources:
|
|
238
|
+
- Safari: `~/Library/Cookies/Cookies.binarycookies` (fallback: `~/Library/Containers/com.apple.Safari/Data/Library/Cookies/Cookies.binarycookies`)
|
|
239
|
+
- Chrome: `~/Library/Application Support/Google/Chrome/<Profile>/Cookies`
|
|
240
|
+
- Firefox: `~/Library/Application Support/Firefox/Profiles/<profile>/cookies.sqlite`
|
|
241
|
+
- For Chromium variants (Arc/Brave/etc), pass a profile directory or cookie DB via `--chrome-profile-dir`.
|
|
242
|
+
|
|
243
|
+
## Config (JSON5)
|
|
244
|
+
|
|
245
|
+
Config precedence: CLI flags > env vars > project config > global config.
|
|
246
|
+
|
|
247
|
+
- Global: `~/.config/bird/config.json5`
|
|
248
|
+
- Project: `./.birdrc.json5`
|
|
249
|
+
|
|
250
|
+
Example `~/.config/bird/config.json5`:
|
|
251
|
+
|
|
252
|
+
```json5
|
|
253
|
+
{
|
|
254
|
+
// Cookie source order for browser extraction (string or array)
|
|
255
|
+
cookieSource: ["firefox", "safari"],
|
|
256
|
+
chromeProfileDir: "/path/to/Chromium/Profile",
|
|
257
|
+
firefoxProfile: "default-release",
|
|
258
|
+
cookieTimeoutMs: 30000,
|
|
259
|
+
timeoutMs: 20000,
|
|
260
|
+
quoteDepth: 1
|
|
261
|
+
}
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
Environment shortcuts:
|
|
265
|
+
- `BIRD_TIMEOUT_MS`
|
|
266
|
+
- `BIRD_COOKIE_TIMEOUT_MS`
|
|
267
|
+
- `BIRD_QUOTE_DEPTH`
|
|
268
|
+
|
|
269
|
+
## Output
|
|
270
|
+
|
|
271
|
+
- `--json` prints raw tweet objects for read/replies/thread/search/mentions/user-tweets/bookmarks/likes.
|
|
272
|
+
- When using `--json` with pagination (`--all`, `--cursor`, `--max-pages`, or for `user-tweets` when `-n > 20`), output is `{ tweets, nextCursor }`.
|
|
273
|
+
- `read` returns full text for Notes and Articles when present.
|
|
274
|
+
- Use `--plain` for stable, script-friendly output (no emoji, no color).
|
|
275
|
+
|
|
276
|
+
### JSON Schema
|
|
277
|
+
|
|
278
|
+
When using `--json`, tweet objects include:
|
|
279
|
+
|
|
280
|
+
| Field | Type | Description |
|
|
281
|
+
|-------|------|-------------|
|
|
282
|
+
| `id` | string | Tweet ID |
|
|
283
|
+
| `text` | string | Full tweet text (includes Note/Article content when present) |
|
|
284
|
+
| `author` | object | `{ username, name }` |
|
|
285
|
+
| `authorId` | string? | Author's user ID |
|
|
286
|
+
| `createdAt` | string | Timestamp |
|
|
287
|
+
| `replyCount` | number | Number of replies |
|
|
288
|
+
| `retweetCount` | number | Number of retweets |
|
|
289
|
+
| `likeCount` | number | Number of likes |
|
|
290
|
+
| `conversationId` | string | Thread conversation ID |
|
|
291
|
+
| `inReplyToStatusId` | string? | Parent tweet ID (present if this is a reply) |
|
|
292
|
+
| `quotedTweet` | object? | Embedded quote tweet (same schema; depth controlled by `--quote-depth`) |
|
|
293
|
+
|
|
294
|
+
When using `--json` with `following`/`followers`, user objects include:
|
|
295
|
+
|
|
296
|
+
| Field | Type | Description |
|
|
297
|
+
|-------|------|-------------|
|
|
298
|
+
| `id` | string | User ID |
|
|
299
|
+
| `username` | string | Username/handle |
|
|
300
|
+
| `name` | string | Display name |
|
|
301
|
+
| `description` | string? | User bio |
|
|
302
|
+
| `followersCount` | number? | Followers count |
|
|
303
|
+
| `followingCount` | number? | Following count |
|
|
304
|
+
| `isBlueVerified` | boolean? | Blue verified flag |
|
|
305
|
+
| `profileImageUrl` | string? | Profile image URL |
|
|
306
|
+
| `createdAt` | string? | Account creation timestamp |
|
|
307
|
+
|
|
308
|
+
When using `--json` with `news`/`trending`, news objects include:
|
|
309
|
+
|
|
310
|
+
| Field | Type | Description |
|
|
311
|
+
|-------|------|-------------|
|
|
312
|
+
| `id` | string | Unique identifier for the news item |
|
|
313
|
+
| `headline` | string | News headline or trend title |
|
|
314
|
+
| `category` | string? | Category (e.g., "AI · Technology", "Trending", "News") |
|
|
315
|
+
| `timeAgo` | string? | Relative time (e.g., "2h ago") |
|
|
316
|
+
| `postCount` | number? | Number of posts |
|
|
317
|
+
| `description` | string? | Item description |
|
|
318
|
+
| `url` | string? | URL to the trend or news article |
|
|
319
|
+
| `tweets` | array? | Related tweets (only when `--with-tweets` is used) |
|
|
320
|
+
| `_raw` | object? | Raw API response (only when `--json-full` is used) |
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
## Query IDs (GraphQL)
|
|
324
|
+
|
|
325
|
+
X rotates GraphQL “query IDs” frequently. Each GraphQL operation is addressed as:
|
|
326
|
+
|
|
327
|
+
- `operationName` (e.g. `TweetDetail`, `CreateTweet`)
|
|
328
|
+
- `queryId` (rotating ID baked into X’s web client bundles)
|
|
329
|
+
|
|
330
|
+
`bird` ships with a baseline mapping in `src/lib/query-ids.json` (copied into `dist/` on build). At runtime,
|
|
331
|
+
it can refresh that mapping by scraping X’s public web client bundles and caching the result on disk.
|
|
332
|
+
|
|
333
|
+
Runtime cache:
|
|
334
|
+
- Default path: `~/.config/bird/query-ids-cache.json`
|
|
335
|
+
- Override path: `BIRD_QUERY_IDS_CACHE=/path/to/file.json`
|
|
336
|
+
- TTL: 24h (stale cache is still used, but marked “not fresh”)
|
|
337
|
+
|
|
338
|
+
Auto-recovery:
|
|
339
|
+
- On GraphQL `404` (query ID invalid), `bird` forces a refresh once and retries.
|
|
340
|
+
- For `TweetDetail`/`SearchTimeline`, `bird` also rotates through a small set of known fallback IDs to reduce
|
|
341
|
+
breakage while refreshing.
|
|
342
|
+
|
|
343
|
+
Refresh on demand:
|
|
344
|
+
|
|
345
|
+
```bash
|
|
346
|
+
bird query-ids --fresh
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
Exit codes:
|
|
350
|
+
- `0`: success
|
|
351
|
+
- `1`: runtime error (network/auth/etc)
|
|
352
|
+
- `2`: invalid usage/validation (e.g. bad `--user` handle)
|
|
353
|
+
|
|
354
|
+
## Version
|
|
355
|
+
|
|
356
|
+
`bird --version` prints `package.json` version plus current git sha when available, e.g. `0.3.0 (3df7969b)`.
|
|
357
|
+
|
|
358
|
+
## Media uploads
|
|
359
|
+
|
|
360
|
+
- Attach media with `--media` (repeatable) and optional `--alt` per item.
|
|
361
|
+
- Up to 4 images/GIFs, or 1 video (no mixing). Supported: jpg, jpeg, png, webp, gif, mp4, mov.
|
|
362
|
+
- Images/GIFs + 1 video supported (uploads via Twitter legacy upload endpoint + cookies; video may take longer to process).
|
|
363
|
+
|
|
364
|
+
Example:
|
|
365
|
+
|
|
366
|
+
```bash
|
|
367
|
+
bird tweet "hi" --media img.png --alt "desc"
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
## Development
|
|
371
|
+
|
|
372
|
+
```bash
|
|
373
|
+
cd ~/Projects/bird
|
|
374
|
+
pnpm install
|
|
375
|
+
pnpm run build # dist/ + bun binary
|
|
376
|
+
pnpm run build:dist # dist/ only
|
|
377
|
+
pnpm run build:binary
|
|
378
|
+
|
|
379
|
+
pnpm run dev tweet "Test"
|
|
380
|
+
pnpm run dev -- --plain check
|
|
381
|
+
pnpm test
|
|
382
|
+
pnpm run lint
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
## Notes
|
|
386
|
+
|
|
387
|
+
- GraphQL uses internal X endpoints and can be rate limited (429).
|
|
388
|
+
- Query IDs rotate; refresh at runtime with `bird query-ids --fresh` (or update the baked baseline via `pnpm run graphql:update`).
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export type PaginationCmdOpts = {
|
|
2
|
+
all?: boolean;
|
|
3
|
+
maxPages?: string;
|
|
4
|
+
cursor?: string;
|
|
5
|
+
delay?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function parsePositiveIntFlag(raw: string | undefined, flagName: string): {
|
|
8
|
+
ok: true;
|
|
9
|
+
value: number | undefined;
|
|
10
|
+
} | {
|
|
11
|
+
ok: false;
|
|
12
|
+
error: string;
|
|
13
|
+
};
|
|
14
|
+
export declare function parseNonNegativeIntFlag(raw: string | undefined, flagName: string, defaultValue: number): {
|
|
15
|
+
ok: true;
|
|
16
|
+
value: number;
|
|
17
|
+
} | {
|
|
18
|
+
ok: false;
|
|
19
|
+
error: string;
|
|
20
|
+
};
|
|
21
|
+
export declare function parsePaginationFlags(cmdOpts: PaginationCmdOpts, opts?: {
|
|
22
|
+
maxPagesImpliesPagination?: boolean;
|
|
23
|
+
defaultDelayMs?: number;
|
|
24
|
+
includeDelay?: boolean;
|
|
25
|
+
}): {
|
|
26
|
+
ok: true;
|
|
27
|
+
usePagination: boolean;
|
|
28
|
+
maxPages?: number;
|
|
29
|
+
cursor?: string;
|
|
30
|
+
pageDelayMs?: number;
|
|
31
|
+
} | {
|
|
32
|
+
ok: false;
|
|
33
|
+
error: string;
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=pagination.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../src/cli/pagination.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,MAAM,GAAG,SAAS,EACvB,QAAQ,EAAE,MAAM,GACf;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CASxE;AAED,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,MAAM,GAAG,SAAS,EACvB,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,GACnB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAM5D;AAED,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,iBAAiB,EAC1B,IAAI,CAAC,EAAE;IACL,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,GAEC;IACE,EAAE,EAAE,IAAI,CAAC;IACT,aAAa,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GACD;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CA8B/B"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export function parsePositiveIntFlag(raw, flagName) {
|
|
2
|
+
if (raw === undefined) {
|
|
3
|
+
return { ok: true, value: undefined };
|
|
4
|
+
}
|
|
5
|
+
const value = Number.parseInt(raw, 10);
|
|
6
|
+
if (!Number.isFinite(value) || value <= 0) {
|
|
7
|
+
return { ok: false, error: `Invalid ${flagName}. Expected a positive integer.` };
|
|
8
|
+
}
|
|
9
|
+
return { ok: true, value };
|
|
10
|
+
}
|
|
11
|
+
export function parseNonNegativeIntFlag(raw, flagName, defaultValue) {
|
|
12
|
+
const value = Number.parseInt(raw ?? String(defaultValue), 10);
|
|
13
|
+
if (!Number.isFinite(value) || value < 0) {
|
|
14
|
+
return { ok: false, error: `Invalid ${flagName}. Expected a non-negative integer.` };
|
|
15
|
+
}
|
|
16
|
+
return { ok: true, value };
|
|
17
|
+
}
|
|
18
|
+
export function parsePaginationFlags(cmdOpts, opts) {
|
|
19
|
+
const maxPagesImpliesPagination = opts?.maxPagesImpliesPagination ?? false;
|
|
20
|
+
const includeDelay = opts?.includeDelay ?? false;
|
|
21
|
+
const defaultDelayMs = opts?.defaultDelayMs ?? 1000;
|
|
22
|
+
const maxPages = parsePositiveIntFlag(cmdOpts.maxPages, '--max-pages');
|
|
23
|
+
if (!maxPages.ok) {
|
|
24
|
+
return maxPages;
|
|
25
|
+
}
|
|
26
|
+
const usePagination = Boolean(cmdOpts.all || cmdOpts.cursor || (maxPagesImpliesPagination && maxPages.value !== undefined));
|
|
27
|
+
let pageDelayMs;
|
|
28
|
+
if (includeDelay) {
|
|
29
|
+
const delay = parseNonNegativeIntFlag(cmdOpts.delay, '--delay', defaultDelayMs);
|
|
30
|
+
if (!delay.ok) {
|
|
31
|
+
return delay;
|
|
32
|
+
}
|
|
33
|
+
pageDelayMs = delay.value;
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
ok: true,
|
|
37
|
+
usePagination,
|
|
38
|
+
maxPages: maxPages.value,
|
|
39
|
+
cursor: cmdOpts.cursor,
|
|
40
|
+
pageDelayMs,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=pagination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../../src/cli/pagination.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,oBAAoB,CAClC,GAAuB,EACvB,QAAgB;IAEhB,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACtB,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;IACxC,CAAC;IACD,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IACvC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;QAC1C,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,QAAQ,gCAAgC,EAAE,CAAC;IACnF,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,uBAAuB,CACrC,GAAuB,EACvB,QAAgB,EAChB,YAAoB;IAEpB,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,IAAI,MAAM,CAAC,YAAY,CAAC,EAAE,EAAE,CAAC,CAAC;IAC/D,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;QACzC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,QAAQ,oCAAoC,EAAE,CAAC;IACvF,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,OAA0B,EAC1B,IAIC;IAUD,MAAM,yBAAyB,GAAG,IAAI,EAAE,yBAAyB,IAAI,KAAK,CAAC;IAC3E,MAAM,YAAY,GAAG,IAAI,EAAE,YAAY,IAAI,KAAK,CAAC;IACjD,MAAM,cAAc,GAAG,IAAI,EAAE,cAAc,IAAI,IAAI,CAAC;IAEpD,MAAM,QAAQ,GAAG,oBAAoB,CAAC,OAAO,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;IACvE,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,MAAM,aAAa,GAAG,OAAO,CAC3B,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,MAAM,IAAI,CAAC,yBAAyB,IAAI,QAAQ,CAAC,KAAK,KAAK,SAAS,CAAC,CAC7F,CAAC;IAEF,IAAI,WAA+B,CAAC;IACpC,IAAI,YAAY,EAAE,CAAC;QACjB,MAAM,KAAK,GAAG,uBAAuB,CAAC,OAAO,CAAC,KAAK,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC;QAChF,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC;YACd,OAAO,KAAK,CAAC;QACf,CAAC;QACD,WAAW,GAAG,KAAK,CAAC,KAAK,CAAC;IAC5B,CAAC;IAED,OAAO;QACL,EAAE,EAAE,IAAI;QACR,aAAa;QACb,QAAQ,EAAE,QAAQ,CAAC,KAAK;QACxB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,WAAW;KACZ,CAAC;AACJ,CAAC"}
|