feat: make --max-pages imply --all for list-timeline
- Remove requirement for --max-pages to be used with --all - Update help text to clarify --max-pages implies --all - Add list-timeline documentation to README with examples 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
This commit is contained in:
committed by
Peter Steinberger
co-authored by
Claude Sonnet 4.5
parent
8fc208ca31
commit
ebcd1618f9
@@ -59,6 +59,11 @@ bird unbookmark https://x.com/user/status/1234567890123456789
|
|||||||
# Likes
|
# Likes
|
||||||
bird likes -n 5
|
bird likes -n 5
|
||||||
|
|
||||||
|
# Lists
|
||||||
|
bird list-timeline 1234567890 -n 20
|
||||||
|
bird list-timeline https://x.com/i/lists/1234567890 --all --json
|
||||||
|
bird list-timeline 1234567890 --max-pages 3 --json
|
||||||
|
|
||||||
# Following (who you follow)
|
# Following (who you follow)
|
||||||
bird following -n 20
|
bird following -n 20
|
||||||
bird following --user 12345678 -n 10 # by user ID
|
bird following --user 12345678 -n 10 # by user ID
|
||||||
@@ -98,6 +103,7 @@ const result = await client.search('from:steipete', 50);
|
|||||||
- `bird bookmarks [-n count] [--folder-id id] [--all] [--max-pages n] [--json]` — list your bookmarked tweets (or a specific bookmark folder); `--max-pages` requires `--all`.
|
- `bird bookmarks [-n count] [--folder-id id] [--all] [--max-pages n] [--json]` — list your bookmarked tweets (or a specific bookmark folder); `--max-pages` requires `--all`.
|
||||||
- `bird unbookmark <tweet-id-or-url...>` — remove one or more bookmarks by tweet ID or URL.
|
- `bird unbookmark <tweet-id-or-url...>` — remove one or more bookmarks by tweet ID or URL.
|
||||||
- `bird likes [-n count] [--json]` — list your liked tweets.
|
- `bird likes [-n count] [--json]` — list your liked tweets.
|
||||||
|
- `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`.
|
||||||
- `bird following [--user <userId>] [-n count] [--json]` — list users that you (or another user) follow.
|
- `bird following [--user <userId>] [-n count] [--json]` — list users that you (or another user) follow.
|
||||||
- `bird followers [--user <userId>] [-n count] [--json]` — list users that follow you (or another user).
|
- `bird followers [--user <userId>] [-n count] [--json]` — list users that follow you (or another user).
|
||||||
- `bird whoami` — print which Twitter account your cookies belong to.
|
- `bird whoami` — print which Twitter account your cookies belong to.
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ export function registerListsCommand(program: Command, ctx: CliContext): void {
|
|||||||
.description('Get tweets from a list timeline')
|
.description('Get tweets from a list timeline')
|
||||||
.option('-n, --count <number>', 'Number of tweets to fetch', '20')
|
.option('-n, --count <number>', 'Number of tweets to fetch', '20')
|
||||||
.option('--all', 'Fetch all tweets from list (paged). WARNING: your account might get banned using this flag')
|
.option('--all', 'Fetch all tweets from list (paged). WARNING: your account might get banned using this flag')
|
||||||
.option('--max-pages <number>', 'Stop after N pages when using --all')
|
.option('--max-pages <number>', 'Fetch N pages (implies --all)')
|
||||||
.option('--cursor <string>', 'Resume pagination from a cursor')
|
.option('--cursor <string>', 'Resume pagination from a cursor')
|
||||||
.option('--json', 'Output as JSON')
|
.option('--json', 'Output as JSON')
|
||||||
.option('--json-full', 'Output as JSON with full raw API response in _raw field')
|
.option('--json-full', 'Output as JSON with full raw API response in _raw field')
|
||||||
@@ -96,11 +96,7 @@ export function registerListsCommand(program: Command, ctx: CliContext): void {
|
|||||||
process.exit(2);
|
process.exit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
const usePagination = cmdOpts.all || cmdOpts.cursor;
|
const usePagination = cmdOpts.all || cmdOpts.cursor || maxPages !== undefined;
|
||||||
if (maxPages !== undefined && !usePagination) {
|
|
||||||
console.error(`${ctx.p('err')}--max-pages requires --all or --cursor.`);
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
if (!usePagination && (!Number.isFinite(count) || count <= 0)) {
|
if (!usePagination && (!Number.isFinite(count) || count <= 0)) {
|
||||||
console.error(`${ctx.p('err')}Invalid --count. Expected a positive integer.`);
|
console.error(`${ctx.p('err')}Invalid --count. Expected a positive integer.`);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
|
|||||||
Reference in New Issue
Block a user