Skip to content

Rohan5commit/news-briefing

Repository files navigation

Daily News Briefing Pipeline

An automated daily news briefing system that fetches headlines, curates them via AI, generates audio, and delivers via email.

Quick Start

# Install dependencies
npm install

# Configure API keys
cp .env.example .env
# Edit .env with your keys

# Test the pipeline (dry run)
npm run dev -- --dry-run --verbose

# Run full pipeline
npm run dev

Features

  • Multi-source Headlines: GNews (primary) + NewsAPI (fallback)
  • AI Curation: NVIDIA NIM (Nemotron) or Perplexity for intelligent story selection
  • Category Mix: Strict 50% AI, 25% Finance, 25% General distribution
  • Audio Briefing: ~5 minute spoken summary via TTS
  • Email Delivery: HTML newsletter + MP3 attachment via SMTP

Required API Keys

Service Purpose Free Tier
GNews Primary headlines 100 req/day
NewsAPI Fallback headlines 100 req/day
Perplexity AI curation (optional) ~$5/month
NVIDIA NIM AI curation (optional) Free tier available
SMTP (Gmail App Password or other provider) Email delivery Free

Provide either PERPLEXITY_API_KEY or NVIDIA_API_KEY to enable LLM curation (otherwise the local scorer is used).

SMTP Setup

See GMAIL_SETUP.md for app-password SMTP instructions (Gmail) or use your SMTP provider details.

CLI Options

npm run dev -- [options]

Options:
  --dry-run      Test without sending email
  --skip-email   Skip email delivery
  --skip-audio   Skip audio generation
  --verbose      Show detailed logs

Architecture

┌─────────────┐     ┌─────────────┐     ┌─────────────┐
│   GNews     │────▶│  Normalize  │────▶│  Perplexity │
│  NewsAPI    │     │  Dedupe     │     │   Curate    │
└─────────────┘     └─────────────┘     └─────────────┘
                                               │
                    ┌─────────────┐     ┌──────▼──────┐
                    │   Gmail     │◀────│    TTS      │
                    │   Send      │     │   Audio     │
                    └─────────────┘     └─────────────┘

Category Mix Rules

  • N = 12 total stories (configurable)
  • AI: ceil(0.50 × N) = 6 stories
  • Finance: floor(0.25 × N) = 3 stories
  • General: N - AI - Finance = 3 stories

Priority for multi-category stories: AI > Finance > General

Daily Scheduling (Recommended)

To run the scheduler persistently in the background (even after restarts):

# Install PM2 globally
npm install -g pm2

# Start the scheduler
pm2 start scheduler.js --name "news-briefing"

# Ensure PM2 starts on boot
pm2 startup
pm2 save

Management Commands

  • pm2 status: Check if the scheduler is running.
  • pm2 logs news-briefing: View the scheduler logs.
  • pm2 restart news-briefing: Restart the scheduler.
  • pm2 stop news-briefing: Stop the scheduler.

License

MIT

GitHub Actions Workflow

This project includes a GitHub Actions workflow for automated daily briefings.

Configuration

  1. Go to your repository Settings > Secrets and variables > Actions.
  2. Add the following Repository secrets:
    • GNEWS_API_KEY
    • NEWSAPI_KEY (Optional)
    • PERPLEXITY_API_KEY (Optional)
    • NVIDIA_API_KEY (Optional)
    • SMTP_HOST
    • SMTP_PORT
    • SMTP_USER
    • SMTP_PASS

Usage

  • Scheduled: Runs automatically every day at 00:00 UTC (8:00 AM SGT).
  • Manual: Go to Actions > Daily News Briefing > Run workflow. You can toggle dry_run, skip_email, and skip_audio inputs.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors