================================================================================ CRUNCHYROLL DOWNLOADER - CHALLENGE 1 SOLUTION Chapter 1: JWT & API Setup Challenge: Project Setup ================================================================================ PROBLEM: Set up the complete project structure: 1. Create crunchy-downloader/ directory 2. Create .env and .env.example files 3. Create requirements.txt with dependencies 4. Create .gitignore with appropriate entries SOLUTION: ================================================================================ STEP 1: Create Project Structure ================================================================================ mkdir crunchy-downloader cd crunchy-downloader STEP 2: Create .env.example (template - SHARE THIS) ================================================================================ File: .env.example # Crunchyroll credentials (DO NOT COMMIT .env!) CRUNCHYROLL_EMAIL=your-email@example.com CRUNCHYROLL_PASSWORD=your-password # API settings API_BASE_URL=https://api.crunchyroll.com TOKEN_CACHE_FILE=token_cache.json STEP 3: Create .env (YOUR credentials - NEVER COMMIT!) ================================================================================ File: .env # Crunchyroll credentials CRUNCHYROLL_EMAIL=emubantam@gmail.com CRUNCHYROLL_PASSWORD=mypassword123 # API settings API_BASE_URL=https://api.crunchyroll.com TOKEN_CACHE_FILE=token_cache.json STEP 4: Create requirements.txt ================================================================================ File: requirements.txt requests==2.31.0 python-dotenv==1.0.0 STEP 5: Install Dependencies ================================================================================ pip install -r requirements.txt Expected: Successfully installed requests-2.31.0 python-dotenv-1.0.0 STEP 6: Create .gitignore ================================================================================ File: .gitignore # Secrets - NEVER commit these! .env token_cache.json *.pyc __pycache__/ # IDE .vscode/ .idea/ FINAL STRUCTURE ================================================================================ crunchy-downloader/ ├── .env ← YOUR credentials (SECRET!) ├── .env.example ← Template (share this) ├── requirements.txt ← Dependencies ├── .gitignore ← Ignore secrets ├── config.py (create in next chapters) ├── crunchyroll_utils.py (create in next chapters) └── download.py (create in next chapters) VERIFICATION CHECKLIST ================================================================================ ✅ .env.example created (public template) ✅ .env created with your credentials (private) ✅ requirements.txt created with requests and python-dotenv ✅ .gitignore prevents committing secrets ✅ Dependencies installed successfully KEY SECURITY POINTS ================================================================================ ⚠️ CRITICAL: - .env is PRIVATE (your username/password!) - token_cache.json will be PRIVATE (JWT tokens!) - Both must be in .gitignore - .env.example is PUBLIC (shows structure only) Never commit: ❌ .env (your credentials) ❌ token_cache.json (JWT tokens) ✅ .env.example (template only) ================================================================================