hvac-kia-content/debug_youtube_videos.py
Ben Reed 05218a873b Fix critical production issues and improve spec compliance
Production Readiness Improvements:
- Fixed scheduling to match spec (8 AM & 12 PM ADT instead of 6 AM/6 PM)
- Enabled NAS synchronization in production runner with error handling
- Fixed file naming convention to spec format (hvacknowitall_combined_YYYY-MM-DD-THHMMSS.md)
- Made systemd services portable (removed hardcoded user/paths)
- Added environment variable validation on startup
- Moved DISPLAY/XAUTHORITY to .env configuration

Systemd Improvements:
- Created template service file (@.service) for any user
- Changed all paths to /opt/hvac-kia-content
- Updated installation script for portable deployment
- Fixed service dependencies and resource limits

Documentation:
- Created comprehensive PRODUCTION_TODO.md with 25 tasks
- Added PRODUCTION_GUIDE.md with deployment instructions
- Documented spec compliance gaps (65% complete)

Remaining work includes retry logic, connection pooling, media downloads,
and pytest test suite as documented in PRODUCTION_TODO.md

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-18 20:07:55 -03:00

61 lines
No EOL
1.9 KiB
Python

#!/usr/bin/env python3
"""
Debug YouTube scraper to get actual videos from the Videos tab.
"""
import os
import sys
from pathlib import Path
from dotenv import load_dotenv
import yt_dlp
# Load environment variables
load_dotenv()
def debug_youtube_videos():
"""Debug YouTube videos from the main Videos tab."""
# Use the direct playlist URL for the Videos tab
videos_url = "https://www.youtube.com/@HVACKnowItAll/videos"
print(f"Testing videos tab: {videos_url}")
# Options to get individual videos
ydl_opts = {
'quiet': False,
'extract_flat': True,
'playlistend': 20, # Get first 20 videos
'ignoreerrors': True,
}
try:
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
print("Extracting videos from Videos tab...")
videos_info = ydl.extract_info(videos_url, download=False)
print(f"\nVideos info keys: {list(videos_info.keys())}")
if 'entries' in videos_info:
videos = [v for v in videos_info['entries'] if v is not None]
print(f"\n✅ Found {len(videos)} actual videos")
# Show video details
for i, video in enumerate(videos[:10]):
title = video.get('title', 'N/A')
video_id = video.get('id', 'N/A')
duration = video.get('duration', 'N/A')
print(f" {i+1}. {title}")
print(f" ID: {video_id}, Duration: {duration}s")
if len(videos) > 10:
print(f" ... and {len(videos) - 10} more videos")
else:
print("❌ No 'entries' key found")
except Exception as e:
print(f"❌ Error: {e}")
import traceback
traceback.print_exc()
if __name__ == "__main__":
debug_youtube_videos()