import sys def main(): with open('trials/index.html', 'r', encoding='utf-8-sig') as f: content = f.read() target = """ 皇都イシュガルド防衛戦 Lv50 (IL90〜) ソロ改修済 雲廊の巨大龍ヴィシャップ迎撃。パッチ6.xによりソロバトル化。 準備中 """ replacement = """ 皇都イシュガルド防衛戦 Lv50 (IL90〜) ソロ改修済 雲廊の巨大龍ヴィシャップ迎撃。パッチ6.xによりソロバトル化。 攻略を見る ➜ """ 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('trials/index.html', 'wb') as f: f.write(b'\xef\xbb\xbf' + content_clean.encode('utf-8')) with open('trials/steps_of_faith.html', 'r', encoding='utf-8-sig') as f: steps = f.read() steps_lines = [line.rstrip() for line in steps.splitlines()] steps_clean = '\r\n'.join(steps_lines) + '\r\n' with open('trials/steps_of_faith.html', 'wb') as f: f.write(b'\xef\xbb\xbf' + steps_clean.encode('utf-8')) print("皇都イシュガルド防衛戦のリンク更新および正規化が完了しました。") if __name__ == '__main__': main()