Sign inSign up

richardthornton/echotube

By richardthornton

โ€ขUpdated about 1 year ago

A lightweight bot that monitors YouTube channels and sends rich notifications to Discord.

Image
0

6.0K

richardthornton/echotube repository overview

โ EchoTube - YouTube to Discord Bot

A lightweight, self-hosted bot that monitors YouTube channels and playlists for new videos containing specific keywords, then posts ultra-clean notifications to Discord via webhooks.

โ Quick Start

# Test your configuration first (recommended)
docker run --rm \
  -e ET_TEST_MODE=true \
  -e ET_CHANNEL_IDS=UCexample1 \
  -e ET_KEYWORDS=minecraft,gaming \
  richardthornton/echotube:latest

# Production deployment
docker run -d \
  --name=echotube \
  -e ET_CHANNEL_IDS=UCexample1,UCexample2 \
  -e ET_KEYWORDS=minecraft,gaming \
  -e ET_DISCORD_WEBHOOK_URLS=https://discord.com/api/webhooks/... \
  -v ./cache:/app/cache \
  richardthornton/echotube:latest

โ Features

  • ๐ŸŽฏ Smart YouTube Monitoring - RSS-based channel and playlist tracking
  • ๐Ÿ” Flexible Keyword Matching - Case-insensitive "any" or "all" matching modes
  • ๐ŸŽจ Ultra-Clean Discord Embeds - Minimal design with large thumbnails
  • ๐ŸŒ Multi-Server Support - Post to multiple Discord servers simultaneously
  • ๐Ÿ“ฆ Single Docker Container - Production-ready (~20MB Alpine image)
  • ๐Ÿง  Intelligent Caching - Prevents duplicates with timestamp recovery
  • ๐Ÿงช Test Mode - Safe configuration validation without posting
  • ๐Ÿ“Š Structured Logging - JSON logs with configurable levels
  • ๐Ÿ”’ Security Hardened - Non-root user, minimal privileges

โ Environment Variables

โ Required
  • ET_DISCORD_WEBHOOK_URLS - Your Discord webhook URLs (comma-separated for multiple servers)
  • ET_KEYWORDS - Comma-separated keywords to match in video titles
โ Content Sources (at least one required)
  • ET_CHANNEL_IDS - Comma-separated YouTube channel IDs (UCxxxxx format)
  • ET_PLAYLIST_IDS - Comma-separated playlist IDs (PLxxxxx format)
โ Optional
  • ET_MATCH_TYPE - any (default) or all keyword matching
  • ET_POLL_INTERVAL_SECONDS - Poll frequency (default: 300, minimum: 60)
  • ET_LOG_LEVEL - DEBUG, INFO (default), WARN, ERROR
  • ET_CACHE_FILE - Path for persistent cache (default: memory only)
  • ET_TEST_MODE - Set to true to validate config without posting
  • ET_DEVELOPMENT_MODE - Set to true to post only one video per source

โ Docker Compose Example

services:
  echotube:
    image: richardthornton/echotube:latest
    container_name: echotube
    restart: unless-stopped
    environment:
      - ET_CHANNEL_IDS=UCexample1,UCexample2
      - ET_KEYWORDS=minecraft,gaming,tutorial
      - ET_DISCORD_WEBHOOK_URLS=https://discord.com/api/webhooks/...
      - ET_POLL_INTERVAL_SECONDS=300
      - ET_LOG_LEVEL=INFO
    volumes:
      - ./cache:/app/cache

โ How to Get YouTube IDs

โ Channel IDs (format: UCxxxxxxxxxxxxxxxxxx)
  1. Go to YouTube channel
  2. Check URL: youtube.com/channel/UCexample or view page source for "channelId":"UC
โ Playlist IDs (format: PLxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)
  1. Go to YouTube playlist
  2. Copy everything after list= in the URL

โ Discord Webhook Setup

  1. In Discord, go to Server Settings > Integrations > Webhooks
  2. Click "Create Webhook"
  3. Choose channel and copy the webhook URL
  4. Use this URL for ET_DISCORD_WEBHOOK_URLS (can specify multiple URLs separated by commas)

โ Health Check

The container includes a built-in health check that monitors the application status.

# Check container health
docker ps

โ Logging

View structured JSON logs with timestamps and operation tracking:

# View logs
docker logs echotube

# Follow logs in real-time
docker logs -f echotube

# Debug logging
docker run -e ET_LOG_LEVEL=DEBUG richardthornton/echotube

โ Available Tags

  • latest - Latest stable release
  • v1.x.x - Specific version tags
  • main - Development branch (not recommended for production)

โ Architecture

  • Base Image: Alpine Linux (security-focused, ~20MB final size)
  • Runtime: Node.js 20+ with native fetch API
  • Dependencies: Minimal (only RSS parser)
  • User: Non-root execution (echotube:1001)
  • Process Manager: dumb-init for proper signal handling

โ Use Cases

  • Gaming Communities - Monitor streamers for new uploads
  • Educational Content - Track programming tutorials
  • Content Curation - Auto-share videos in Discord servers
  • Development Updates - Get notified about releases

โ Important Notes

  • YouTube RSS feeds show only the 25 most recent videos
  • Only matches video titles (descriptions not available via RSS)
  • Public content only - no private playlists
  • Uses Discord webhook rate limiting to prevent spam
  • On first run, marks existing videos as seen without posting

โ Support

โ License

MIT ยฉ Richard Thornton


EchoTube: Because YouTube notifications should be clean and simple. โœจ

Tag summary

Content type

Image

Digest

sha256:07dde1827โ€ฆ

Size

46.1 MB

Last updated

about 1 year ago

docker pull richardthornton/echotube