feat: add bookmarks command
Add `bird bookmarks` command to fetch the authenticated user's bookmarked tweets. - New `getBookmarks()` method in TwitterClient - Uses graphql_timeline_v2_bookmark_timeline feature flag - Supports `--count` and `--json` options - Follows existing patterns for query ID rotation and retry logic Usage: bird bookmarks # Get your recent bookmarks bird bookmarks -n 50 # Get 50 bookmarks bird bookmarks --json # Output as JSON 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 4.5
parent
5532e7ddc2
commit
9c553e46bf
@@ -138,6 +138,7 @@ const KNOWN_COMMANDS = new Set([
|
||||
'thread',
|
||||
'search',
|
||||
'mentions',
|
||||
'bookmarks',
|
||||
'help',
|
||||
'whoami',
|
||||
'check',
|
||||
@@ -310,6 +311,7 @@ program
|
||||
'TweetDetail',
|
||||
'SearchTimeline',
|
||||
'UserArticlesTweets',
|
||||
'Bookmarks',
|
||||
];
|
||||
|
||||
if (cmdOpts.fresh) {
|
||||
@@ -671,6 +673,39 @@ program
|
||||
}
|
||||
});
|
||||
|
||||
// Bookmarks command - get user's bookmarks
|
||||
program
|
||||
.command('bookmarks')
|
||||
.description('Get your bookmarked tweets')
|
||||
.option('-n, --count <number>', 'Number of bookmarks to fetch', '20')
|
||||
.option('--json', 'Output as JSON')
|
||||
.action(async (cmdOpts: { count?: string; json?: boolean }) => {
|
||||
const opts = program.opts();
|
||||
const timeoutMs = resolveTimeoutFromOptions(opts);
|
||||
const count = Number.parseInt(cmdOpts.count || '20', 10);
|
||||
|
||||
const { cookies, warnings } = await resolveCredentialsFromOptions(opts);
|
||||
|
||||
for (const warning of warnings) {
|
||||
console.error(`${p('warn')}${warning}`);
|
||||
}
|
||||
|
||||
if (!cookies.authToken || !cookies.ct0) {
|
||||
console.error(`${p('err')}Missing required credentials`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const client = new TwitterClient({ cookies, timeoutMs });
|
||||
const result = await client.getBookmarks(count);
|
||||
|
||||
if (result.success && result.tweets) {
|
||||
printTweets(result.tweets, { json: cmdOpts.json, emptyMessage: 'No bookmarks found.' });
|
||||
} else {
|
||||
console.error(`${p('err')}Failed to fetch bookmarks: ${result.error}`);
|
||||
process.exit(1);
|
||||
}
|
||||
});
|
||||
|
||||
// Whoami command - show the logged-in account
|
||||
program
|
||||
.command('whoami')
|
||||
|
||||
Reference in New Issue
Block a user