def __init__(self, api_key: Optional[str] = None):
        """
        Initialize the YoutubeSearch tool.
        
        Args:
            api_key: The Serper API key. If not provided, will try to load from environment or .env file.
        """
        # Check dependencies
        self.__control__()
        
        # Set API key
        self.api_key = api_key
        
        # If API key is not provided, try to get it from environment variable
        if self.api_key is None:
            import os
            self.api_key = os.environ.get("SERPER_API_KEY")
            
        # If still not found, try to load from .env file
        if self.api_key is None:
            self.api_key = self._load_api_key_from_env_file()
            
        # If still not found, raise error
        if self.api_key is None:
            missing_api_key("YoutubeSearch", "SERPER_API_KEY")
            raise ValueError("Serper API key not found. Please provide it as an argument, set it as an environment variable, or add it to your .env file.")

        Initialize the YoutubeSearch tool.
        
        Args:
            api_key: The Serper API key. If not provided, will try to load from environment or .env file.
        
src/upsonic/tools.py