- Add cookies support in youtube.js service - Create extract-cookies.sh script for automatic cookie extraction - Add YOUTUBE_COOKIES_PATH environment variable - Update .env.example with cookies configuration - Add comprehensive documentation (YOUTUBE_COOKIES.md, COOKIES_QUICK_START.md) - Update .gitignore to exclude cookies files for security - Pass cookiesPath option through all download functions This fixes Sign in to confirm you're not a bot errors from YouTube. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
2.6 KiB
2.6 KiB
Quick Start: Fix YouTube "Sign in to confirm you're not a bot"
The Problem
YouTube blocks automated downloads with this error:
Sign in to confirm you're not a bot
The Solution
Use cookies from your browser to authenticate!
Step-by-Step Instructions
1. Extract Cookies (Choose ONE method)
Method A: Automatic (Chrome/Firefox on same machine)
cd /home/debian/videotomp3transcriptor
bash scripts/extract-cookies.sh
Follow the prompts and choose your browser.
Method B: Manual (Any browser, any machine)
-
Install browser extension:
- Chrome/Edge: Get cookies.txt LOCALLY
- Firefox: cookies.txt
-
Go to YouTube and log in:
- Visit https://www.youtube.com
- Make sure you're logged into your account
-
Export cookies:
- Click the extension icon
- Click "Export" or "Download"
- Save the file as
youtube-cookies.txt
-
Upload to server:
# On your local machine scp youtube-cookies.txt debian@toMP3.etheryale.com:/home/debian/videotomp3transcriptor/
2. Configure the API
Edit .env file:
nano /home/debian/videotomp3transcriptor/.env
Add or uncomment this line:
YOUTUBE_COOKIES_PATH=/home/debian/videotomp3transcriptor/youtube-cookies.txt
Save and exit (Ctrl+X, then Y, then Enter)
3. Restart the API
pm2 restart toMP3-api
4. Test It
curl -X POST http://localhost:3001/download \
-H "Content-Type: application/json" \
-d '{"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"}'
If it works, you'll see download progress! 🎉
Common Issues
"Permission denied" when reading cookies
chmod 600 /home/debian/videotomp3transcriptor/youtube-cookies.txt
Cookies expired
Re-export fresh cookies from your browser. Cookies typically last a few weeks.
Still getting "not a bot" error
- Make sure you logged into YouTube before exporting cookies
- Try a different browser
- Check the path in
.envis correct - Verify the file exists:
ls -la /home/debian/videotomp3transcriptor/youtube-cookies.txt
Security Warning ⚠️
Cookies = Your YouTube Session
- Keep cookies file secure (like a password)
- Never commit to git (already in .gitignore)
- Don't share publicly
- Re-export periodically when they expire
Need More Help?
See full documentation: docs/YOUTUBE_COOKIES.md