Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 15, 2025

Adds options to provide YouTube cookies when downloading to bypass bot detection, with multiple methods for obtaining cookies.

Changes Summary

  • YouTube cookies textarea input - Users can paste cookies in Netscape format in the Download Settings form
  • "Get Cookie Extension" button - Links to the recommended "Get cookies.txt LOCALLY" Chrome extension
  • Step-by-step usage instructions - Proper <ol> list markup for accessibility with screen readers
  • "Use cookies from server's Chrome browser" checkbox - Option to automatically use cookies from Chrome installed on the server machine via yt-dlp's --cookies-from-browser feature
  • Server-side handling - Creates temp file from pasted cookies content, passes to yt-dlp, with proper cleanup using os.path.exists() check and error logging

Screenshot

Cookies from Browser Checkbox

Original prompt

Add an option to provide YouTube cookies when downloading, also add a button that grabs YouTube cookies from the current browser and autofills the field using any cookie extractor (choose the best one).


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits December 15, 2025 20:56
Co-authored-by: maple-underscore <102273486+maple-underscore@users.noreply.github.com>
Co-authored-by: maple-underscore <102273486+maple-underscore@users.noreply.github.com>
Copilot AI changed the title [WIP] Add option for YouTube cookies in download feature Add YouTube cookies input field for bot detection bypass Dec 15, 2025
@maple-underscore maple-underscore marked this pull request as ready for review December 15, 2025 21:41
Copilot AI review requested due to automatic review settings December 15, 2025 21:41
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for providing YouTube cookies to bypass bot detection when downloading videos. Users can paste cookies in Netscape format via a new textarea field, with a convenient button linking to the recommended cookie extraction extension.

Key Changes:

  • Added UI textarea for cookie input with extension link and usage instructions
  • Implemented server-side temporary file handling for cookies passed from the frontend
  • Modified payload structure to support cookies_content field

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@maple-underscore
Copy link
Owner

@copilot apply changes based on the comments in this thread

Co-authored-by: maple-underscore <102273486+maple-underscore@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 15, 2025

@copilot apply changes based on the comments in this thread

Applied all review feedback in commit 9735f3e:

  1. File cleanup - Now stores file path separately (cookies_temp_path) and checks os.path.exists() before deletion
  2. Context manager - Changed to with statement for proper resource management
  3. Comment clarity - Updated to "Send undefined if cookies field is empty to reduce payload size"
  4. Accessibility - Changed to proper <ol> with <li> elements for screen reader support

Updated UI

@maple-underscore
Copy link
Owner

@copilot If there is a way to do this, can you implement a button that directly grabs cookies from the website page?

Copy link
Contributor Author

Copilot AI commented Dec 15, 2025

@copilot If there is a way to do this, can you implement a button that directly grabs cookies from the website page?

Unfortunately, this isn't possible due to browser security restrictions. JavaScript running on a webpage cannot access cookies from other domains (like youtube.com) - this is enforced by the Same-Origin Policy to prevent cross-site scripting attacks.

The options for grabbing YouTube cookies are:

  1. Browser extension (current approach) - Extensions have elevated permissions to access cookies across domains
  2. yt-dlp's --cookies-from-browser - Extracts cookies directly from browser databases (already supported via CLI with --cookies-from-browser chrome/firefox/etc)

The server-side already supports cookies_from_browser parameter if you want to add a dropdown to select a browser instead of pasting cookies manually. Would you like me to add that option?

@maple-underscore
Copy link
Owner

@copilot Yes, then add a checkbox to use cookies from the chrome browser on the server machine.

Co-authored-by: maple-underscore <102273486+maple-underscore@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 15, 2025

@copilot Yes, then add a checkbox to use cookies from the chrome browser on the server machine.

Added in commit 80dc513. New checkbox "Use cookies from server's Chrome browser" sends cookies_from_browser: 'chrome' to yt-dlp's --cookies-from-browser feature.

Screenshot

Copilot AI changed the title Add YouTube cookies input field for bot detection bypass Add YouTube cookies support for bot detection bypass Dec 15, 2025
@github-actions
Copy link

github-actions bot commented Dec 15, 2025

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@maple-underscore maple-underscore merged commit 68bfcfe into main Dec 15, 2025
8 checks passed
@maple-underscore maple-underscore deleted the copilot/add-youtube-cookies-support branch December 15, 2025 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants