└── config.py /config.py: -------------------------------------------------------------------------------- 1 | import os 2 | from pathlib import Path 3 | 4 | class Config: 5 | # Telegram Bot Configuration 6 | API_ID = int(os.environ.get("API_ID", 0)) # Replace with your actual API ID 7 | API_HASH = os.environ.get("API_HASH", "") # Replace with your actual API Hash 8 | BOT_TOKEN = os.environ.get("BOT_TOKEN", "") # Replace with your actual Bot Token 9 | OWNER_ID = int(os.environ.get("OWNER_ID", 0)) # Replace with your Telegram User ID 10 | 11 | # Paths 12 | BASE_DIR = Path(__file__).parent 13 | DOWNLOAD_DIR = BASE_DIR / "downloads" 14 | SESSION_DIR = BASE_DIR / "sessions" 15 | 16 | # Download and Processing Limits 17 | MAX_FILE_SIZE = 2 * 1024 * 1024 * 1024 # 2GB - Telegram limit 18 | SPLIT_SIZE = 1.9 * 1024 * 1024 * 1024 # 1.9GB per part (safe margin) 19 | CHUNK_SIZE = 10 * 1024 * 1024 # 10MB for faster operations 20 | PROGRESS_INTERVAL = 10 # seconds for progress updates 21 | 22 | # Timeouts and Retry 23 | BROWSER_TIMEOUT = 60 24 | DOWNLOAD_TIMEOUT = 600 # 10 minutes for large files 25 | PAGE_LOAD_WAIT = 10 26 | MAX_RETRIES = 3 # Max retries for 403 errors 27 | 28 | # Video Splitting 29 | ENABLE_AUTO_SPLIT = True # Auto-split videos > 2GB 30 | USE_AIOFILES_SPLIT = True # Use fast aiofiles splitting 31 | SPLIT_METHOD = "time" # "time" or "size" based splitting 32 | 33 | # Create necessary directories 34 | @classmethod 35 | def init_directories(cls): 36 | cls.DOWNLOAD_DIR.mkdir(exist_ok=True, parents=True) 37 | cls.SESSION_DIR.mkdir(exist_ok=True, parents=True) 38 | 39 | # Initialize directories 40 | Config.init_directories() 41 | --------------------------------------------------------------------------------