import sys def main(): with open('trials/index.html', 'r', encoding='utf-8-sig') as f: content = f.read() target = """ 絶アレキサンダー討滅戦 Lv80 (IL475シンク) 絶 (Ultimate) リビングリキッド、チェイサー・ジャスティス、完全体アレキ。称号「The Perfect Legend」。 準備中 """ replacement = """ 絶アレキサンダー討滅戦 Lv80 (IL475シンク) 絶 (Ultimate) リビングリキッド、チェイサー・ジャスティス、完全体アレキ。称号「The Perfect Legend」。 攻略を見る ➜ """ 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/ultimate_alexander.html', 'r', encoding='utf-8-sig') as f: alex = f.read() alex_lines = [line.rstrip() for line in alex.splitlines()] alex_clean = '\r\n'.join(alex_lines) + '\r\n' with open('trials/ultimate_alexander.html', 'wb') as f: f.write(b'\xef\xbb\xbf' + alex_clean.encode('utf-8')) print("絶アレキサンダー討滅戦のリンク更新および正規化が完了しました。") if __name__ == '__main__': main()