import os import random # Input and output directories INPUT_DIR = "html_pages" OUTPUT_DIR = "html_pages_updated" os.makedirs(OUTPUT_DIR, exist_ok=True) # Define your variants (3 lines each) variants = [ [ import os import random # Input and output directories INPUT_DIR = "html_pages" OUTPUT_DIR = "html_pages_updated" os.makedirs(OUTPUT_DIR, exist_ok=True) # Define your variants (3 lines each) variants = [ [ import os import random # Input and output directories INPUT_DIR = "html_pages" OUTPUT_DIR = "html_pages_updated" os.makedirs(OUTPUT_DIR, exist_ok=True) # Define your variants (3 lines each) variants = [ [ " ], [ "\n", ], [ "\n", ], [ "\n", ], [ "\n", ], [ "\n", ], [ "\n", ], [ "\n", ], [ "\n", ], [ "\n", ], [ "\n", ], [ "\n", ], [ "\n", ], v [ "\n", ], [ "\n", ], [ "\n", ], [ "\n", ], [ "\n", ], [ "\n", ], [ "\n", ], [ "\n", ], [ "\n", ], [ "\n", ], [ "\n", ], # ... add as many as you need ] # Process each HTML file for filename in os.listdir(INPUT_DIR): if filename.endswith(".html"): filepath = os.path.join(INPUT_DIR, filename) with open(filepath, "r", encoding="utf-8") as f: content = f.readlines() new_content = [] skip = False for line in content: # Detect the beginning of footer block if line.strip().startswith(" if skip: if line.strip().startswith(""): skip = False continue new_content.append(line) # Save updated file outpath = os.path.join(OUTPUT_DIR, filename) with open(outpath, "w", encoding="utf-8") as f: f.writelines(new_content) print("✅ All footers replaced! Updated files saved in:", OUTPUT_DIR) ], [ "\n", ], [ "\n", ], # ... add as many as you need ] # Process each HTML file for filename in os.listdir(INPUT_DIR): if filename.endswith(".html"): filepath = os.path.join(INPUT_DIR, filename) with open(filepath, "r", encoding="utf-8") as f: content = f.readlines() new_content = [] skip = False for line in content: # Detect the beginning of footer block if line.strip().startswith(" if skip: if line.strip().startswith(""): skip = False continue new_content.append(line) # Save updated file outpath = os.path.join(OUTPUT_DIR, filename) with open(outpath, "w", encoding="utf-8") as f: f.writelines(new_content) print("✅ All footers replaced! Updated files saved in:", OUTPUT_DIR) , ], [ "\n", ], [ "\n", ], # ... add as many as you need ] # Process each HTML file for filename in os.listdir(INPUT_DIR): if filename.endswith(".html"): filepath = os.path.join(INPUT_DIR, filename) with open(filepath, "r", encoding="utf-8") as f: content = f.readlines() new_content = [] skip = False for line in content: # Detect the beginning of footer block if line.strip().startswith(" if skip: if line.strip().startswith(""): skip = False continue new_content.append(line) # Save updated file outpath = os.path.join(OUTPUT_DIR, filename) with open(outpath, "w", encoding="utf-8") as f: f.writelines(new_content) print("✅ All footers replaced! Updated files saved in:", OUTPUT_DIR)