import sys def main(): with open('trials/index.html', 'r', encoding='utf-8-sig') as f: content = f.read() target = """ 善王モグル・モグXII世 / 極モグ Lv50 (IL54〜/80〜) 真 / 極 (8人) 家臣モグ7体のHP削り調整、闘魂注入、メメント・モーグリ。 準備中 """ replacement = """ 善王モグル・モグXII世 / 極モグ Lv50 (IL54〜/80〜) 真 / 極 (8人) 家臣モグ7体のHP削り調整、闘魂注入、メメント・モーグリ。 攻略を見る ➜ """ 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/good_king_moggle_mog.html', 'r', encoding='utf-8-sig') as f: mog = f.read() mog_lines = [line.rstrip() for line in mog.splitlines()] mog_clean = '\r\n'.join(mog_lines) + '\r\n' with open('trials/good_king_moggle_mog.html', 'wb') as f: f.write(b'\xef\xbb\xbf' + mog_clean.encode('utf-8')) print("善王モグル・モグXII世のリンク更新および正規化が完了しました。") if __name__ == '__main__': main()