No description
Find a file
RedWizard 852c462d76 Update default model to deepseek-reasoner and apply consistent formatting
- Change default DeepSeek model from deepseek-chat to deepseek-reasoner
- Apply consistent double quotes, line endings, and import organization
- Add # noqa comments for flake8 compliance
- Update documentation and configuration files

💘 Generated with Crush

Assisted-by: Deepseek V3.2 (Thinking) via Crush <crush@charm.land>
2025-12-31 14:00:58 -05:00
src Update default model to deepseek-reasoner and apply consistent formatting 2025-12-31 14:00:58 -05:00
templates Add spotlight feature for highlighting articles by keywords 2025-12-30 23:09:09 -05:00
.crush.json Refactor project into modular architecture with YAML configuration 2025-12-30 15:12:25 -05:00
.env.example Refactor project into modular architecture with YAML configuration 2025-12-30 15:12:25 -05:00
.gitignore Add AGENTS.md documentation and update .gitignore 2025-12-29 23:15:21 -05:00
AGENTS.md Update default model to deepseek-reasoner and apply consistent formatting 2025-12-31 14:00:58 -05:00
deepseek_newsletter.py Update default model to deepseek-reasoner and apply consistent formatting 2025-12-31 14:00:58 -05:00
default.yaml Update default model to deepseek-reasoner and apply consistent formatting 2025-12-31 14:00:58 -05:00
LICENSE updated license 2025-12-29 23:22:09 -05:00
README.md Update default model to deepseek-reasoner and apply consistent formatting 2025-12-31 14:00:58 -05:00
requirements.txt Refactor project into modular architecture with YAML configuration 2025-12-30 15:12:25 -05:00
themes.yaml Refactor project into modular architecture with YAML configuration 2025-12-30 15:12:25 -05:00

News.Abolish.Capital Summary Tool

A Python tool that generates analytical newsletters from Lemmy posts using the DeepSeek API. The tool applies a Materialist Dialectical World View to analyze news through the lens of historical materialism, class struggle, and structural power dynamics.

Features

  • Lemmy Integration: Fetches posts from a Lemmy instance local feed
  • AI-Powered Analysis: Uses DeepSeek API to generate insightful newsletters
  • Thematic Categorization: Configurable theme system for organizing articles by topic
  • Flexible Output: Generates markdown newsletters with timestamped filenames
  • Command-line Interface: Extensive options for customization
  • Environment Configuration: Supports .env files for API keys and settings
  • Theme Analysis: AI-assisted theme configuration suggestions

Installation

Prerequisites

Install Dependencies

pip install requests html2text PyYAML

Or using requirements.txt:

pip install -r requirements.txt

Or create a virtual environment:

python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install -r requirements.txt

Quick Start

  1. Clone the repository

    git clone https://forge.redwizard.party/RedWizard/news-summary-bot.git
    cd news-summary-bot
    
  2. Configure environment

    cp .env.example .env
    # Edit .env and add your DeepSeek API key
    
  3. Run the newsletter generator

    python deepseek_newsletter.py
    

The script will fetch the latest weekly articles from abolish.capital and generate a newsletter in deepseek_newsletter_YYYYMMDD_HHMMSS.md.

Configuration

Environment Variables

Create a .env file based on .env.example:

# DeepSeek API key (required)
DEEPSEEK_API_KEY=sk-your-key-here

# Lemmy instance credentials (required)
LEMMY_INSTANCE_URL=https://lemmy.example.com
LEMMY_USERNAME=your_username
LEMMY_PASSWORD=your_password

Note: Most other settings (sort type, model parameters, etc.) are now configured in default.yaml.

Theme Configuration

Edit themes.yaml to customize article categorization:

  • categories: Maps RSS feed categories to display names
  • themes: Array of themes with associated keywords for categorization
  • default_theme: Fallback theme for uncategorized articles

Example theme configuration:

{
  "themes": [
    {
      "name": "Labor & Economy",
      "keywords": ["worker", "union", "strike", "wages", "billionaire"]
    },
    {
      "name": "Imperialism & Foreign Policy",
      "keywords": ["war", "sanctions", "intervention", "military", "NATO"]
    }
  ]
}

Usage

Basic Commands

# Generate weekly newsletter with default settings
python deepseek_newsletter.py

# Generate daily newsletter
python deepseek_newsletter.py --sort TopDay

# Generate newsletter with custom output file
python deepseek_newsletter.py --output newsletter.md

# Dry run (see prompt without API call)
python deepseek_newsletter.py --dry-run

# Limit to 10 articles and fetch full content
python deepseek_newsletter.py --max-articles 10 --fetch-content

# Analyze themes and suggest config updates
python deepseek_newsletter.py --analyze-themes

Command Line Arguments

Argument Description Default
--rss-source RSS feed URL or local file abolish.capital TopWeek
--sort Sort period (TopWeek, TopDay, TopMonth, etc.) TopWeek
--output, -o Output file path auto-generated
--model DeepSeek model deepseek-reasoner
--temperature Generation temperature 0.7
--max-tokens Max response tokens 4000
--timeout API timeout (seconds) 60
--dry-run Print prompt without API call false
--api-key DeepSeek API key from env var
--max-articles Limit articles processed 0 (all)
--fetch-content Fetch full article content false
--analyze-themes Analyze themes and suggest updates false

Sorting Options

Available sort periods for RSS feeds:

  • TopHour, TopSixHour, TopTwelveHour
  • TopDay, TopWeek, TopMonth, TopYear
  • TopAll, TopThreeMonths, TopSixMonths, TopNineMonths
  • Active, Hot, New, Old
  • MostComments, NewComments, Controversial, Scaled

Output Format

Newsletters are generated in markdown format with the following structure:

  1. Title & Introduction: Compelling title and overview of major themes
  2. Top Stories: 3-5 most significant developments with analysis
  3. Thematic Analysis: Articles grouped by interconnected themes
  4. Publication Spotlight: Patterns in coverage across publications
  5. Systemic Patterns: Broader patterns revealing capitalist contradictions
  6. Conclusion & Outlook: Summary and watchlist for coming period

Example output file: deepseek_newsletter_20251229_220542.md

Analytical Perspective

The newsletter generator applies a Materialist Dialectical World View, analyzing news through:

  • Historical Materialism: Understanding events through material conditions
  • Class Struggle: Analyzing power dynamics between social classes
  • Structural Analysis: Connecting surface events to systemic forces
  • Contradiction Analysis: Identifying tensions within capitalist society

The tone is rigorous yet accessible, avoiding both academic jargon and simplistic rhetoric.

Troubleshooting

Common Issues

API Timeout

# Increase timeout
python deepseek_newsletter.py --timeout 120

# Limit articles to reduce prompt size
python deepseek_newsletter.py --max-articles 15

SSL Certificate Errors The script includes fallback logic for expired certificates. Some sites may still fail.

403 Forbidden Errors Many news sites block automated requests. This is expected behavior.

Missing Dependencies

pip install requests html2text PyYAML

Debug Mode

# See detailed output
python deepseek_newsletter.py --dry-run

# Check environment variables
cat .env

Project Structure

summary-of-week/
├── deepseek_newsletter.py    # Main script
├── requirements.txt          # Python dependencies
├── config.json               # Theme configuration
├── config.sample.json        # Example configuration
├── .env.example              # Environment template
├── .gitignore               # Git ignore rules
├── LICENSE                   # MIT License
├── AGENTS.md                # Agent documentation
└── README.md                # This file

License

ANTI-CAPITALIST SOFTWARE LICENSE - see LICENSE file for details.

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make changes
  4. Test with --dry-run
  5. Submit a pull request

Acknowledgments

  • abolish.capital for the RSS feed
  • DeepSeek for the AI API
  • The Python community for feedparser, requests, and html2text libraries