import sys def main(): with open('dungeons/index.html', 'r', encoding='utf-8-sig') as f: content = f.read() target = """ 伝統試練 バルダム覇道 Lv65 (IL250〜) 対応 アジムステップの試練。ボス2は「攻撃禁止・ギミック回避専念テスト」。 準備中 """ replacement = """ 伝統試練 バルダム覇道 Lv65 (IL250〜) 対応 アジムステップの試練。ボス2は「攻撃禁止・ギミック回避専念テスト」。 攻略を見る ➜ """ 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/bardams_mettle.html', 'r', encoding='utf-8-sig') as f: bar = f.read() bar_lines = [line.rstrip() for line in bar.splitlines()] bar_clean = '\r\n'.join(bar_lines) + '\r\n' with open('dungeons/bardams_mettle.html', 'wb') as f: f.write(b'\xef\xbb\xbf' + bar_clean.encode('utf-8')) print("伝統試練 バルダム覇道のリンク更新および正規化が完了しました。") if __name__ == '__main__': main()