import sys def main(): with open('dungeons/index.html', 'r', encoding='utf-8-sig') as f: content = f.read() target = """ 偽りのユートピア グルグ火山 Lv79 (IL410〜) 対応 巨大タロースで突入する空中火山。罪喰い大まとめ、フォーギヴン・ヴェラー。 準備中 """ replacement = """ 偽りのユートピア グルグ火山 Lv79 (IL410〜) 対応 巨大タロースで突入する空中火山。罪喰い大まとめ、フォーギヴン・ヴェラー。 攻略を見る ➜ """ 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/mt_gulg.html', 'r', encoding='utf-8-sig') as f: gulg = f.read() gulg_lines = [line.rstrip() for line in gulg.splitlines()] gulg_clean = '\r\n'.join(gulg_lines) + '\r\n' with open('dungeons/mt_gulg.html', 'wb') as f: f.write(b'\xef\xbb\xbf' + gulg_clean.encode('utf-8')) print("偽りのユートピア グルグ火山のリンク更新および正規化が完了しました。") if __name__ == '__main__': main()