import sys def main(): with open('dungeons/index.html', 'r', encoding='utf-8-sig') as f: content = f.read() target = """ 深淵潜行 月の地下渓谷 Lv90 (IL635〜) 対応 パッチ6.5メインID。月面深部・闇の回廊。ゼロムス前哨戦。アントリオン。 準備中 """ replacement = """ 深淵潜行 月の地下渓谷 Lv90 (IL635〜) 対応 パッチ6.5メインID。月面深部・闇の回廊。ゼロムス前哨戦。アントリオン。 攻略を見る ➜ """ 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/lunar_subterrane.html', 'r', encoding='utf-8-sig') as f: lun = f.read() lun_lines = [line.rstrip() for line in lun.splitlines()] lun_clean = '\r\n'.join(lun_lines) + '\r\n' with open('dungeons/lunar_subterrane.html', 'wb') as f: f.write(b'\xef\xbb\xbf' + lun_clean.encode('utf-8')) print("深淵潜行 月の地下渓谷のリンク更新および正規化が完了しました。") if __name__ == '__main__': main()