Implement pyotp functionality for YouTube video downloading with 2FA support #346
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements TOTP (Time-based One-Time Password) functionality for use with playwright automation in YouTube video downloading workflows that require 2FA authentication.
Changes Made
Core TOTP Functionality
pyotpdependency tosetup.cfgsrc/ac_training_lab/video_editing/totp_utils.pywith lean, minimal TOTP utilities:generate_totp_code()- Generate TOTP codes from Base32 secretsverify_totp_code()- Verify TOTP codes against secretsget_totp_code_from_env()- Retrieve TOTP codes from environment variablescreate_totp_provisioning_uri()- Create URIs for authenticator app setupYouTube Integration
src/ac_training_lab/video_editing/yt_utils.pywith TOTP support:get_current_totp_for_youtube()- Get YouTube-specific TOTP from environmentdownload_youtube_with_totp()- Enhanced download function with 2FA supportTesting & Documentation
tests/test_totp_utils.pyandtests/test_youtube_totp.pydocs/totp_usage.mdexamples/totp_example.pydemonstrating real-world usagevideo-editingextras group for optional dependenciesUsage Example
Installation
The implementation is lean and minimal as requested, without fake/mock implementations in the core functionality. It's designed specifically for playwright automation workflows requiring YouTube 2FA authentication.
Fixes #345.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.