#!/usr/bin/env python3
"""Build combined Joomla article from 4 Prime Day deal files."""
import re
import json
def extract_deal_blocks(html_content):
"""Extract all deal div blocks from HTML content."""
# Find all deal div blocks (flex containers with images)
blocks = re.findall(
r'
(.*?)
\s*',
html_content, re.DOTALL
)
# Also try the card class variant from devices file
if not blocks:
blocks = re.findall(
r'(.*?)
\s*',
html_content, re.DOTALL
)
return blocks
def extract_deal_blocks_full(html_content):
"""Extract full deal div blocks including the outer div."""
blocks = re.findall(
r'(.*?
\s*)',
html_content, re.DOTALL
)
if not blocks:
blocks = re.findall(
r'(.*?
\s*)',
html_content, re.DOTALL
)
return blocks
def extract_deal_blocks_devices(html_content):
"""Extract deal blocks from the devices file (uses class='card')."""
blocks = re.findall(
r'(.*?)
(?=\s*(?:|
|