def _clean_text(self, content: bytes) -> str:
        """Clean HTML content and return plain text."""
        try:
            import re

            text = content.decode("utf-8", errors="ignore")
            # Remove HTML tags
            text = re.sub(r"<[^>]+>", " ", text)
            # Normalize whitespace
            text = re.sub(r"\s+", " ", text)
            # Remove any remaining HTML entities
            text = re.sub(r"&[^;]+;", " ", text)
            return text.strip()
        except Exception as e:
            logger.warning(f"Error cleaning text: {e}")
            return ""
Clean HTML content and return plain text.
py/core/parsers/structured/epub_parser.py