config.yaml with automatic fallback to sensible defaults.
Config File Location
The CLI searches forconfig.yaml in this order:
- Current working directory:
./config.yaml - Package root:
twitter_cli/../config.yaml
twitter_cli/config.py:69-83
Default Configuration
If noconfig.yaml is found, the CLI uses these defaults:
twitter_cli/config.py:14-38
Configuration Schema
fetch Section
Controls how many items to retrieve per request:
| Field | Type | Default | Description |
|---|---|---|---|
count | int | 50 | Tweets fetched per paginated request |
twitter_cli/config.py:104-109
filter Section
Configures tweet filtering and engagement scoring:
| Field | Type | Default | Description |
|---|---|---|---|
mode | string | "topN" | Filter mode: "topN", "score", or "all" |
topN | int | 20 | Number of top tweets to keep (min: 1) |
minScore | float | 50.0 | Minimum engagement score threshold |
lang | list[str] | [] | Language codes (e.g., ["en", "ja"]). Empty = no filter |
excludeRetweets | bool | false | Exclude retweets from results |
weights | dict | See below | Engagement scoring weights |
twitter_cli/config.py:111-135
Filter Modes
topN: Sort by score and return top N tweetsscore: Return all tweets withscore >= minScoreall: Return all tweets, sorted by score
rateLimit Section
Controls request timing and retry behavior:
| Field | Type | Default | Description |
|---|---|---|---|
requestDelay | float | 2.5 | Seconds between requests (randomized ×0.7–1.5) |
maxRetries | int | 3 | Retry count for 429 errors (min: 0) |
retryBaseDelay | float | 5.0 | Base delay for exponential backoff (min: 1.0) |
maxCount | int | 200 | Maximum items per fetch operation (min: 1) |
twitter_cli/config.py:137-146
Example Configurations
Aggressive Filtering
Keep only high-engagement English tweets:Conservative (Low Ban Risk)
Slow, safe requests with minimal filtering:Language-Specific Feed
Japanese tweets only, top 30 by engagement:Configuration Loading
The CLI merges yourconfig.yaml with defaults using deep merge:
twitter_cli/config.py:41-66
Normalization Rules
The CLI normalizes config values to prevent errors:fetch.count: Coerced toint, minimum1filter.mode: Must be"topN","score", or"all"(defaults to"topN")filter.topN: Coerced toint, minimum1filter.minScore: Coerced tofloatfilter.lang: Coerced tolist[str]filter.weights.*: Coerced tofloatrateLimit.requestDelay: Coerced tofloat, minimum0.0rateLimit.maxRetries: Coerced toint, minimum0rateLimit.retryBaseDelay: Coerced tofloat, minimum1.0rateLimit.maxCount: Coerced toint, minimum1
twitter_cli/config.py:98-148
Invalid values are coerced to defaults rather than causing errors. Check logs for warnings.
Validation
Troubleshooting
Config not loading
Cause:config.yaml in wrong directory or has syntax errors.
Solution:
- Place
config.yamlin working directory - Validate YAML syntax:
yamllint config.yaml - Check file permissions:
ls -la config.yaml
Filter not applying
Cause: Filter only applies when--filter flag is passed.
Solution:
Unexpected values
Cause: Config normalization coerced invalid values to defaults. Solution:- Check logs for warnings
- Verify types match schema
- Use quoted strings for string values
Next Steps
Filtering
Learn about the engagement scoring algorithm
Authentication
Set up cookies and environment variables
