hvac-kia-content/automated_backlog_capture.py
Ben Reed 0a795437a7 Optimize Instagram scraper and increase capture targets to 1000
- Increased Instagram rate limit from 100 to 200 posts/hour
- Reduced delays: 10-20s (was 15-30s), extended breaks 30-60s (was 60-120s)
- Extended break interval: every 10 requests (was 5)
- Updated capture targets: 1000 posts for Instagram, 1000 videos for TikTok
- Added production deployment and monitoring scripts
- Created environment configuration template

This provides ~40-50% speed improvement for Instagram scraping and
captures 5x more Instagram content and 3.3x more TikTok content.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-18 22:59:11 -03:00

67 lines
No EOL
2.2 KiB
Python

#!/usr/bin/env python3
"""
Automated Production Backlog Capture
Runs without user interaction for automated deployment
"""
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent))
from production_backlog_capture import ProductionBacklogCapture
import logging
# Set up logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
handlers=[
logging.FileHandler('automated_backlog_capture.log'),
logging.StreamHandler()
]
)
logger = logging.getLogger(__name__)
def main():
"""Automated execution without user prompts"""
logger.info("🚀 Starting automated production backlog capture")
logger.info("=" * 60)
logger.info("Downloading complete historical content from ALL sources")
logger.info("Including all available media files (images, videos, audio)")
logger.info("=" * 60)
# Initialize capture
capture = ProductionBacklogCapture()
# Capture all backlogs automatically
summary = capture.capture_all_backlogs()
# Sync to NAS if any content was captured
if summary["total_items"] > 0:
nas_success = capture.sync_to_nas()
summary["nas_sync_success"] = nas_success
else:
logger.warning("No content captured - skipping NAS sync")
summary["nas_sync_success"] = False
# Final summary
logger.info(f"🎉 AUTOMATED BACKLOG CAPTURE COMPLETE!")
logger.info(f"📊 Summary:")
logger.info(f" • Total items captured: {summary['total_items']:,}")
logger.info(f" • Total media files: {summary['total_media_files']:,}")
logger.info(f" • Sources processed: {summary['successful_sources']}/{summary['total_sources']}")
logger.info(f" • Duration: {summary['total_duration']/60:.1f} minutes")
logger.info(f" • NAS sync: {'' if summary.get('nas_sync_success') else ''}")
return summary["successful_sources"] > 0
if __name__ == "__main__":
try:
success = main()
sys.exit(0 if success else 1)
except KeyboardInterrupt:
logger.info("Automated backlog capture interrupted")
sys.exit(1)
except Exception as e:
logger.critical(f"Automated backlog capture failed: {e}")
sys.exit(2)