from pathlib import Path
from PIL import Image
import base64, mimetypes, re
base_html_path = Path(“/mnt/data/mentoria_ls_launch_sem_fotos.html”)
if not base_html_path.exists():
raise FileNotFoundError(“O arquivo-base da página não foi encontrado.”)
assets = {
“inicio”: Path(“/mnt/data/ChatGPT Image 23_07_2026, 09_53_38.png”),
“logo”: Path(“/mnt/data/ChatGPT Image 25 de jun. de 2026, 20_17_54(3).png”),
“fundo”: Path(“/mnt/data/ChatGPT Image 21_07_2026, 14_20_45(1).png”),
“founders”: Path(“/mnt/data/ChatGPT Image 23_07_2026, 00_39_55.png”),
}
for name, path in assets.items():
if not path.exists():
raise FileNotFoundError(f”Imagem não encontrada: {path}”)
def data_uri(path: Path) -> str:
mime = mimetypes.guess_type(path.name)[0] or “image/png”
return f”data:{mime};base64,” + base64.b64encode(path.read_bytes()).decode(“ascii”)
src = {k: data_uri(v) for k, v in assets.items()}
html = base_html_path.read_text(encoding=”utf-8″)
# Insert a strong visual override stylesheet before
override_css = f”””
“””
html = html.replace(““, override_css + “\n“)
# Strengthen top brand naming
html = html.replace(
‘
Mentoria LS Launch
‘,
‘
Mentoria SL Launch
‘
)
# Replace first deadline text and add cart closure block in hero
html = html.replace(
‘
⏳ Inscrições abertas até 28/07
‘,
‘
⏳ Carrinho fecha dia 28/07. Depois dessa data, as vagas serão encerradas.
‘
)
html = html.replace(
‘
‘,
‘
⚠️ Vagas limitadas: o carrinho fecha em 28/07
‘,
1
)
# Add urgency strip before the benefits section
marker = ‘‘
html = html.replace(
marker,
‘
⚠️ Carrinho fecha dia 28/07 — após essa data, as inscrições serão encerradas.