videotomp3transcriptor/COOKIES_QUICK_START.md
Debian User ea0caa9349 Add YouTube cookies support to bypass bot detection
- 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>
2025-12-05 13:32:35 +00:00

110 lines
2.6 KiB
Markdown

# 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)
```bash
cd /home/debian/videotomp3transcriptor
bash scripts/extract-cookies.sh
```
Follow the prompts and choose your browser.
#### Method B: Manual (Any browser, any machine)
1. **Install browser extension:**
- Chrome/Edge: [Get cookies.txt LOCALLY](https://chrome.google.com/webstore/detail/get-cookiestxt-locally/cclelndahbckbenkjhflpdbgdldlbecc)
- Firefox: [cookies.txt](https://addons.mozilla.org/en-US/firefox/addon/cookies-txt/)
2. **Go to YouTube and log in:**
- Visit https://www.youtube.com
- Make sure you're logged into your account
3. **Export cookies:**
- Click the extension icon
- Click "Export" or "Download"
- Save the file as `youtube-cookies.txt`
4. **Upload to server:**
```bash
# On your local machine
scp youtube-cookies.txt debian@toMP3.etheryale.com:/home/debian/videotomp3transcriptor/
```
### 2. Configure the API
Edit `.env` file:
```bash
nano /home/debian/videotomp3transcriptor/.env
```
Add or uncomment this line:
```bash
YOUTUBE_COOKIES_PATH=/home/debian/videotomp3transcriptor/youtube-cookies.txt
```
Save and exit (Ctrl+X, then Y, then Enter)
### 3. Restart the API
```bash
pm2 restart toMP3-api
```
### 4. Test It
```bash
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
```bash
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
1. Make sure you logged into YouTube before exporting cookies
2. Try a different browser
3. Check the path in `.env` is correct
4. 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](docs/YOUTUBE_COOKIES.md)