🤖 A CLI tool that transforms web content into polished blog posts using AI. Scrape websites, pull Reddit discussions, and let OpenAI/Claude craft engaging articles - all from your terminal. Features a sleek TUI interface and smart image handling with AI-generated alt text.
- Scrape content from multiple websites
- Parse Reddit posts and subreddits
- Generate AI-powered alt text for images
- Choose between OpenAI or Claude for blog generation
- Command-line interface with Click
- Support for multiple URLs and subreddits in a single command
- Clone the repository:
git clone https://github.com/Victor-Evogor/ai-blog-writer
cd ai-blog-generator
- Install dependencies:
pip install -r requirements.txt
- Set up environment variables in
.env
:
OPENAI_API_KEY=
CLAUDE_API_KEY=
REDDIT_CLIENT_ID=
REDDIT_CLIENT_SECRET=
Start the API server:
uvicorn api.main:app --reload
Access the API documentation:
- Swagger UI: http://127.0.0.1:8000/docs
- ReDoc: http://127.0.0.1:8000/redoc
The API provides endpoints for:
POST /generate
: Generate a blog post from URLs and subredditsGET /
: Get API information
Example API request:
curl -X POST http://127.0.0.1:8000/generate \
-H "Content-Type: application/json" \
-d '{
"urls": ["https://example.com"],
"subreddits": ["technology"],
"ai_model": "openai"
}'
Basic usage with website URLs:
python cli.py -u https://example.com -u https://example2.com -m openai
Using Reddit content:
python cli.py -s programming -s "https://reddit.com/r/programming/comments/example"
Combining both sources with Claude AI:
python cli.py -u https://example.com -s programming -m claude
Launch the interactive TUI:
python tui.py
Or use Trogon to automatically generate a TUI from the CLI:
python cli.py --tui
The TUI provides an interactive interface where you can:
- Enter a blog title
- Add multiple URLs and subreddits
- Select the AI model
- Generate the blog with a single click
-u, --urls
: Website URLs to scrape (can be used multiple times)-s, --subreddits
: Subreddit names or post URLs (can be used multiple times)-m, --ai-model
: Choose AI model ('openai' or 'claude', default: 'openai')
- Python 3.7+
- Beautiful Soup 4
- Click
- PRAW (Python Reddit API Wrapper)
- OpenAI API key
- Claude API key
- Reddit API credentials
cli.py
: Main CLI interfacescraper.py
: Website content scraperreddit_parser.py
: Reddit content parserblog_generator.py
: AI blog generation logicimage_processor.py
: Image processing and alt text generation
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
Victor Evogor
- Twitter: @victorevogor