from pathlib import Path
import base64, re
base_path = Path("/mnt/data/Pasted text(78).txt")
latest_path = Path("/mnt/data/lightspeed-ai-product-sales-page-final-with-new-reveal.html")
header_img_path = Path("/mnt/data/gemini.png")
reveal_img_path = Path("/mnt/data/94c1d27c-0d72-41c0-b788-a2d76b8720a2.jpg")
out_path = Path("/mnt/data/lightspeed-ai-product-sales-page-merged-final.html")
for p in [base_path, latest_path, header_img_path, reveal_img_path]:
if not p.exists():
raise FileNotFoundError(p)
base = base_path.read_text(encoding="utf-8")
latest = latest_path.read_text(encoding="utf-8")
# Embed the new top header image.
header_uri = "data:image/png;base64," + base64.b64encode(header_img_path.read_bytes()).decode("ascii")
base, n = re.subn(
r'(
]*>\s*
]*>\s*
.*?', latest, flags=re.S)
if latest_opening:
base = re.sub(r'.*?', latest_opening.group(0), base, count=1, flags=re.S)
# Pull updated product reveal section from latest.
latest_reveal = re.search(r'', latest, flags=re.S)
if latest_reveal:
base = re.sub(r'', latest_reveal.group(0), base, count=1, flags=re.S)
# Ensure the approved AI-slop paragraph exists.
approved = (
'Today, almost anyone can ask AI to write a report. '
'The problem is, most of what it produces is what people now call “AI slop.” '
'Very few people know how to turn AI into a product-development partner instead of an AI slop generator. '
'That is exactly what I will show you how to do.
'
)
if "AI slop generator" not in base:
anchor = "But not much of a product.
"
base = base.replace(anchor, anchor + "\n " + approved, 1)
# Ensure the Two Hour Product Creation clarification is present in product reveal.
two_hour_note = (
''
'Important: This is not the same material from my recent '
'Two Hour Product Creation offer. That course teaches you how to create '
'AI tools. This one teaches you how to create sellable information products '
'with AI by talking into your phone.
'
)
if "Two Hour Product Creation" not in base:
base = re.sub(
r'(.*?.*?
)',
r'\1' + two_hour_note,
base,
count=1,
flags=re.S
)
# Replace the product reveal image with the latest reveal image, while keeping a proportioned container.
reveal_uri = "data:image/jpeg;base64," + base64.b64encode(reveal_img_path.read_bytes()).decode("ascii")
new_product_stage = f'''
'''
# Replace either an existing image stage or old mockup stage.
base, n1 = re.subn(
r'\s*\s*',
"\n" + new_product_stage,
base,
count=1,
flags=re.S
)
if n1 == 0:
base, n2 = re.subn(
r'\s*
.*?
\s*
\s*',
"\n" + new_product_stage,
base,
count=1,
flags=re.S
)
if n2 == 0:
raise RuntimeError("Could not replace product reveal stage.")
# Remove any older product-image CSS blocks and insert one proportioned like a book/mockup.
base = re.sub(r'\.product-image-stage\{.*?\}\s*\.product-reveal-image\{.*?\}\s*@media\(max-width:700px\)\{.*?\.product-reveal-image\{.*?\}\s*\}', '', base, flags=re.S)
product_css = """
.product-image-stage{
min-height:0;
width:min(620px,calc(100% - 60px));
margin:0 auto;
padding:20px 16px 30px;
}
.product-reveal-image{
display:block;
width:100%;
max-width:560px;
height:auto;
margin:0 auto;
border-radius:14px;
border:4px solid #fff;
box-shadow:0 18px 38px rgba(10,34,56,.22);
}
@media(max-width:700px){
.product-image-stage{
width:calc(100% - 32px);
padding:8px 0 18px;
}
.product-reveal-image{
max-width:100%;
border-width:3px;
border-radius:10px;
}
}
"""
base = base.replace("", product_css + "\n", 1)
# Use the latest reveal subhead.
base = re.sub(
r'.*?
',
'Learn the exact process I use to turn ideas, experience, and AI into polished, sellable information products—without wasting weeks writing from scratch.
',
base,
count=1,
flags=re.S
)
out_path.write_text(base, encoding="utf-8")
print(f"Created: {out_path}")
print(f"File size: {out_path.stat().st_size:,} bytes")
print("Checks:", {
"AI_slop": base.count("AI slop"),
"Two_Hour": base.count("Two Hour Product Creation"),
"header_img": base.count("data:image/png;base64,"),
"reveal_img": base.count("product-reveal-image"),
})