# 🍪 Quick Setup: YouTube Cookies **YouTube bot detection requires logged-in cookies.** --- ## 🚀 Method 1: Extract from your local Firefox (EASIEST) ### On your local machine (PC/laptop): ```bash # Install yt-dlp if needed pip install yt-dlp # Login to YouTube in Firefox first # Then extract cookies: yt-dlp --cookies-from-browser firefox --cookies youtube-cookies.txt 'https://youtube.com' # Upload to server: scp youtube-cookies.txt debian@vps-a20accb1.vps.ovh.net:/home/debian/videotomp3transcriptor/ ``` ### On server: ```bash # Restart service cd /home/debian/videotomp3transcriptor pm2 restart music-service # or npm start # Test curl -X POST http://localhost:8889/download \ -H "Content-Type: application/json" \ -d '{"url": "https://youtube.com/watch?v=fukChj4eh-Q"}' ``` **Duration**: Cookies last 2-4 weeks, then repeat. --- ## 🦊 Method 2: Camoufox with manual login (if you have VNC/X11) Only works if you can open GUI on server (VNC, X11 forwarding). ```bash cd /home/debian/videotomp3transcriptor python3 src/python/extract_cookies_with_login.py # Browser opens → Login to YouTube → Press Enter # Cookies saved! ``` --- ## ⚙️ Method 3: Browser extension (Alternative) 1. Install extension in Firefox: - https://addons.mozilla.org/firefox/addon/cookies-txt/ 2. Go to YouTube, login 3. Click extension → Export → Save as `youtube-cookies.txt` 4. Upload to server (see Method 1) --- ## ✅ Verify cookies work: ```bash yt-dlp --cookies youtube-cookies.txt --skip-download "https://youtube.com/watch?v=dQw4w9WgXcQ" ``` If no error → Cookies work! --- ## 🔄 Auto-refresh (once initial cookies uploaded): The service will: - ✅ Use your logged-in cookies - ✅ Validate them daily - ✅ Work for 2-4 weeks - ⚠️ Need manual refresh when expired **Future improvement**: VNC-based auto-login script (not implemented yet). --- **For now**: Use Method 1 (extract from local Firefox) - takes 2 minutes!