import sys def main(): with open('dungeons/index.html', 'r', encoding='utf-8-sig') as f: content = f.read() target = """ 電脳夢想 スティグマ・フォー Lv90 (IL540〜) 非対応 オミクロン族の戦闘マトリクス。プロトオメガの召喚、竜型兵器迎撃。 準備中 """ replacement = """ 電脳夢想 スティグマ・フォー Lv90 (IL540〜) 非対応 オミクロン族の戦闘マトリクス。プロトオメガの召喚、竜型兵器迎撃。 攻略を見る ➜ """ 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/stigma_four.html', 'r', encoding='utf-8-sig') as f: sti = f.read() sti_lines = [line.rstrip() for line in sti.splitlines()] sti_clean = '\r\n'.join(sti_lines) + '\r\n' with open('dungeons/stigma_four.html', 'wb') as f: f.write(b'\xef\xbb\xbf' + sti_clean.encode('utf-8')) print("電脳夢想 スティグマ・フォーのリンク更新および正規化が完了しました。") if __name__ == '__main__': main()