Some YouTube videos require authentication cookies to bypass bot detection. If you encounter "Sign in to confirm you're not a bot" errors, follow these steps to export your YouTube cookies.
-
Install the extension "Get cookies.txt LOCALLY"
-
Visit YouTube.com and sign in to your account
-
Click the extension icon in your browser toolbar
-
Click "Export" button
-
Save the file as
cookies.txtin the Voice2Note project root directory:/home/opc/Desktop/Voice2Note/cookies.txt
-
Install the extension "cookies.txt"
- Firefox Add-ons: https://addons.mozilla.org/en-US/firefox/addon/cookies-txt/
-
Visit YouTube.com and sign in to your account
-
Click the extension icon in your toolbar
-
Click "Export cookies.txt"
-
Save the file as
cookies.txtin the Voice2Note project root directory
If you have Chrome/Firefox installed and logged into YouTube:
# For Chrome
yt-dlp --cookies-from-browser chrome --cookies cookies.txt "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
# For Firefox
yt-dlp --cookies-from-browser firefox --cookies cookies.txt "https://www.youtube.com/watch?v=dQw4w9WgXcQ"This will create a cookies.txt file that you can reuse.
-
Privacy: The cookies.txt file contains your authentication tokens. Keep it secure and don't share it.
-
Expiration: Cookies expire over time (usually days to weeks). If downloads stop working, export fresh cookies.
-
File Location: The app automatically looks for
cookies.txtin:/home/opc/Desktop/Voice2Note/cookies.txt -
Gitignore: cookies.txt is already in .gitignore, so it won't be committed to git.
After adding cookies.txt, test with a video:
source venv/bin/activate
python -c "
from processors.video_handler import VideoHandler
vh = VideoHandler()
result = vh.download_youtube_audio('https://www.youtube.com/watch?v=YOUR_VIDEO_ID')
print(f'Success! Downloaded: {result[\"title\"]}')
""ERROR: Sign in to confirm you're not a bot"
- Solution: Export fresh cookies using Method 1 above
"Cookies file not found"
- Make sure the file is named exactly
cookies.txt(all lowercase) - Check the file is in the correct directory:
/home/opc/Desktop/Voice2Note/
Downloads work without cookies.txt
- Great! Most videos don't need cookies. Only bot-protected videos require them.
If you're accessing from your phone:
- Use a browser on your phone to access YouTube
- Install the extension (if supported) or use method 2
- Transfer the cookies.txt file to your server using:
# On phone (Termux) scp cookies.txt opc@your-server:/home/opc/Desktop/Voice2Note/cookies.txt