https://github.com/bm-github/x-analyser
Analyse X posts with LLM
https://github.com/bm-github/x-analyser
Last synced: 12 months ago
JSON representation
Analyse X posts with LLM
- Host: GitHub
- URL: https://github.com/bm-github/x-analyser
- Owner: bm-github
- License: mit
- Created: 2025-01-18T21:22:48.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-19T13:55:29.000Z (over 1 year ago)
- Last Synced: 2025-04-03T15:45:54.596Z (about 1 year ago)
- Language: Python
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Twitter/X Analyzer
CLI tool for analyzing Twitter/X user activity using OpenRouter API and LLMs.
## Prerequisites
- Python 3.8+
- Twitter/X API Bearer Token
- OpenRouter API Key
## Setup
1. Create a `keys` directory two levels up from the script:
```bash
mkdir -p ../../keys
```
2. Add API keys:
```bash
echo "your-twitter-bearer-token" > ../../keys/x-token.txt
echo "your-openrouter-key" > ../../keys/key-openrouter.txt
```
## Installation
```bash
pip install tweepy requests rich
```
## Usage
Run the analyzer:
```bash
python x-analyser-openrouter.py
```
The tool will:
1. Prompt for a Twitter handle
2. Fetch recent tweets (cached for 24 hours)
3. Allow interactive questions about the user's tweets
4. Generate AI-powered analysis using OpenRouter
## Features
- Tweet caching (24-hour expiry)
- Rich CLI interface
- Interactive Q&A about tweet patterns
- Configurable LLM model selection
- Excludes retweets and replies
## Error Handling
- Validates API keys on startup
- Handles rate limits and API errors
- Provides clear error messages in the CLI
## Dependencies
- `tweepy`: Twitter API client
- `requests`: HTTP client
- `rich`: Terminal formatting
- `pathlib`: File operations
## License
MIT