#!/usr/bin/env python3 path = "/var/www/html/weval-technology-platform.html" with open(path, "r", encoding="utf-8") as f: c = f.read() if "V131-WTP-ARENA" in c: print("ALREADY") exit(0) # The actual line uses 2-space indent based on hexdump marker = ' Blade/GPU' if marker not in c: # Try 4-space marker = ' Blade/GPU' if marker not in c: # Try 6-space (as in earlier visible content) marker = ' Blade/GPU' if marker not in c: print("no indent variant matches") exit(1) addition = marker + '\n' + marker.replace('/blade-hub.html">Blade/GPU', '/weval-arena.html" target="_blank">WEVAL Arena') + ' ' c = c.replace(marker, addition, 1) with open(path, "w", encoding="utf-8") as f: f.write(c) print(f"PATCHED size={len(c)}")