import sys def main(): with open('dungeons/index.html', 'r', encoding='utf-8-sig') as f: content = f.read() target = """ 古跡探索 キタンナ神影洞 Lv75 (IL390〜) 対応 ラケティカ大森林の古代ロンカ遺跡。肩の像からの熱線照射、エロースの毒沼。 準備中 """ replacement = """ 古跡探索 キタンナ神影洞 Lv75 (IL390〜) 対応 ラケティカ大森林の古代ロンカ遺跡。肩の像からの熱線照射、エロースの毒沼。 攻略を見る ➜ """ 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/qitana_ravel.html', 'r', encoding='utf-8-sig') as f: qit = f.read() qit_lines = [line.rstrip() for line in qit.splitlines()] qit_clean = '\r\n'.join(qit_lines) + '\r\n' with open('dungeons/qitana_ravel.html', 'wb') as f: f.write(b'\xef\xbb\xbf' + qit_clean.encode('utf-8')) print("古跡探索 キタンナ神影洞のリンク更新および正規化が完了しました。") if __name__ == '__main__': main()