This is a YouTube giveaway monitoring system that automatically tracks responses from contest hosts to user comments. The application monitors multiple YouTube videos for replies from specific uploader channels and sends email notifications when responses are detected. It's designed to help users stay informed about potential giveaway wins or important communications from YouTube content creators.
Preferred communication style: Simple, everyday language.
The system follows a simple polling-based architecture with three main components:
Authentication Layer: Uses Google OAuth 2.0 flow with local credential storage via pickle files. The auth_bootstrap.py script handles initial authentication setup for local development, while the main application loads stored credentials from token.pickle.
YouTube API Integration: Leverages Google's YouTube Data API v3 to fetch comment threads and replies. The system polls comment data at configurable intervals (currently 1 minute) to detect new responses from monitored channels.
Notification System: Implements SMTP-based email notifications using Gmail's service. Sends alerts when replies from target uploaders are detected on monitored videos.
State Management: Uses a simple JSON file (seen_replies.json) to track already-processed replies and prevent duplicate notifications. This lightweight approach avoids the need for a traditional database.
Configuration Storage: All configuration is handled through environment variables and hardcoded constants, making the system easy to deploy and modify.
The application implements a multi-video, multi-channel monitoring system:
- Tracks multiple giveaway videos simultaneously via
VIDEO_IDSarray - Monitors responses from specific uploader channels via
UPLOADER_CHANNEL_IDS - Filters for replies to comments from user's own channels via
YOUR_CHANNEL_IDS
The system includes credential refresh mechanisms for expired tokens and basic error handling for API failures. The polling-based approach provides resilience against temporary service interruptions.
- YouTube Data API v3: Primary integration for accessing video comments and replies
- Google OAuth 2.0: Authentication mechanism for YouTube API access
- Google Client Libraries:
googleapiclient.discovery,google_auth_oauthlib.flow,google.auth.transport.requests
- Gmail SMTP: Email notification delivery using app-specific passwords
- Python SMTP Library: Built-in email sending capabilities
- Python Standard Libraries:
pickle,json,time,smtplib,osfor core functionality - Email MIME:
email.mime.textfor email formatting
- Google Cloud Project with YouTube Data API enabled
- OAuth 2.0 credentials file (
client_secret.json) - Gmail app password for SMTP authentication
- Environment variables for sensitive configuration data