import sys def main(): with open('dungeons/index.html', 'r', encoding='utf-8-sig') as f: content = f.read() target = """ 解放決戦 ドマ城 Lv67 (IL255〜) 対応 ドマ解放戦。帝国軍迎撃、ガンシップ爆撃、強化グリーンワート。 準備中 """ replacement = """ 解放決戦 ドマ城 Lv67 (IL255〜) 対応 ドマ解放戦。帝国軍迎撃、ガンシップ爆撃、強化グリーンワート。 攻略を見る ➜ """ if target not in content: print("エラー: ターゲット文字列が見つかりません") sys.exit(1) content = content.replace(target, replacement) lines = [line.rstrip() for line in content.splitlines()] content_clean = '\r\n'.join(lines) + '\r\n' with open('dungeons/index.html', 'wb') as f: f.write(b'\xef\xbb\xbf' + content_clean.encode('utf-8')) with open('dungeons/doma_castle.html', 'r', encoding='utf-8-sig') as f: dom = f.read() dom_lines = [line.rstrip() for line in dom.splitlines()] dom_clean = '\r\n'.join(dom_lines) + '\r\n' with open('dungeons/doma_castle.html', 'wb') as f: f.write(b'\xef\xbb\xbf' + dom_clean.encode('utf-8')) print("解放決戦 ドマ城のリンク更新および正規化が完了しました。") if __name__ == '__main__': main()