An automated daily bulletin generator for the World Socialist Web Site (WSWS). This tool scrapes recent articles and perspectives, synthesizes them using AI, and converts the summary to audio.
- Web Scraping: Automatically fetches recent articles from WSWS archive and the latest perspective
- AI Synthesis: Uses Claude (Anthropic) or GPT-4 (OpenAI) to synthesize and summarize articles with focus on:
- Major political developments and their class character
- Theoretical and historical lessons from current events
- Connections between global struggles
- Strategic implications for the international working class
- Text-to-Speech: Converts bulletins to audio using Coqui TTS (local) or OpenAI TTS
- CLI Interface: Easy-to-use command-line tool
- Python 3.9 or higher
- API key for Anthropic or OpenAI
# Clone the repository
git clone https://github.com/yourusername/wsws-bulletin.git
cd wsws-bulletin
# Install in development mode
pip install -e .
# Or install with all dependencies
pip install -e ".[dev]"-
Copy the example environment file:
cp .env.example .env
-
Edit
.envand add your API keys:# Choose your AI provider AI_PROVIDER=anthropic # or "openai" # Add your API key ANTHROPIC_API_KEY=your_key_here # or OPENAI_API_KEY=your_key_here # Optional: configure TTS engine TTS_ENGINE=coqui # or "openai" for OpenAI TTS # Optional: set output directory OUTPUT_DIR=./output
# Generate bulletin with default settings (last 24 hours)
wsws-bulletin generate
# Look back 48 hours instead
wsws-bulletin generate --hours 48
# Skip audio generation (text only)
wsws-bulletin generate --no-audio
# Specify output directory
wsws-bulletin generate --output-dir /path/to/output
# Use specific AI provider
wsws-bulletin generate --ai-provider openai
# Use OpenAI TTS instead of local Coqui TTS
wsws-bulletin generate --tts-engine openai# List articles from last 24 hours
wsws-bulletin list-articles
# List articles from last 48 hours
wsws-bulletin list-articles --hours 48# Verify your configuration and dependencies
wsws-bulletin checkThe tool generates two files in the output directory:
-
Markdown bulletin (
bulletin_YYYY-MM-DD.md): Complete synthesized summary with:- Executive summary
- Major political developments
- Theoretical and historical insights
- International connections
- Key takeaways
- Links to source articles
-
Audio file (
bulletin_YYYY-MM-DD.wavor.mp3): Audio version of the bulletin
OpenAI's TTS produces higher quality audio but requires an OpenAI API key and costs money per generation:
wsws-bulletin generate --tts-engine openaiOr set in .env:
TTS_ENGINE=openaiCoqui TTS runs locally and is free, but may be slower on first run (downloads model):
wsws-bulletin generate --tts-engine coquiwsws-bulletin generate --env-file /path/to/custom/.envThe tool consists of four main modules:
-
scraper.py: Web scraping functionality for WSWS- Fetches recent articles from archive
- Retrieves latest perspective article
- Extracts full article content
-
synthesizer.py: AI-powered analysis and synthesis- Formats articles for LLM processing
- Generates comprehensive analysis with Marxist perspective
- Structures output for advanced readers
-
text_to_speech.py: Text-to-speech conversion- Supports Coqui TTS (local, free)
- Supports OpenAI TTS (cloud, paid)
-
__main__.py: Command-line interface- User-friendly commands
- Configuration validation
- Progress reporting
pip install -e ".[dev]"black wsws_bulletin/
ruff check wsws_bulletin/pytestThis usually means no articles were published in the specified time window. Try increasing --hours:
wsws-bulletin generate --hours 48On first run, Coqui TTS downloads a model (~100MB). If this fails:
- Check your internet connection
- Try OpenAI TTS instead:
--tts-engine openai - Manually clear cache:
rm -rf ~/.local/share/tts
Make sure your API keys are set correctly:
wsws-bulletin checkContributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
This tool is an independent project and is not affiliated with or endorsed by the World Socialist Web Site or the International Committee of the Fourth International.