Skip to content

Repository files navigation

AI Twitter Tracker

Python project for collecting tweets, selecting top-performing posts, extracting tone/style patterns with LLM, and generating draft posts.

What It Does

  • Scrapes tweets from configured accounts (TwitterAPI.io provider).
  • Stores data in PostgreSQL.
  • Selects top tweets by configurable percentile and date window.
  • Extracts repeatable writing patterns (hooks, structure, vocabulary).
  • Generates post drafts based on the extracted tone guide.
  • Includes a Streamlit UI for manual pipeline runs and monitoring.

Stack

  • Python 3.11+
  • PostgreSQL
  • Streamlit
  • OpenAI/OpenRouter/Anthropic (at least one provider for LLM stages)

Quick Start

git clone <your-public-repo-url>
cd AI-Twitter-Tracker

cp .env.example .env
# Fill your credentials in .env

pip install -r requirements.txt
python scripts/migrate.py

# Optional smoke test
python src/twitter_scraper.py --accounts="sample_account_1" --max-tweets=20 --dry-run

# Run UI
streamlit run streamlit_app.py --server.address=127.0.0.1 --server.port=8501

Main Commands

# Scrape tweets
python src/twitter_scraper.py --accounts="sample_account_1,sample_account_3" --max-tweets=100

# Select top tweets
python src/select_top_tweets.py --hours-back=24 --top-percentile=20

# Analyze patterns
python src/analyze_patterns.py --top-tweets-limit=50

# Generate posts
python src/generate_posts.py --count=20

Project Structure

src/                 # Pipeline scripts and shared utils
scripts/             # Setup/migration/bootstrap scripts
tests/               # Unit + E2E tests
streamlit_app.py     # Dashboard UI
.env.example         # Config template

Testing

pytest tests/ -v

Notes

  • .env is intentionally excluded from git.
  • This public version excludes internal docs and local workspace artifacts.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages