import sys def main(): with open('trials/index.html', 'r', encoding='utf-8-sig') as f: content = f.read() target = """ ニーズヘッグ征竜戦 / 極ニーズヘッグ Lv60 (IL205〜/220〜) ノーマル / 極 竜詩戦争完結。真紅の珠、竜尾竜翼、堕天のドラゴンダイブ。 準備中 """ replacement = """ ニーズヘッグ征竜戦 / 極ニーズヘッグ Lv60 (IL205〜/220〜) ノーマル / 極 竜詩戦争完結。真紅の珠、竜尾竜翼、堕天のドラゴンダイブ。 攻略を見る ➜ """ 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/nidhogg.html', 'r', encoding='utf-8-sig') as f: nidhogg = f.read() nidhogg_lines = [line.rstrip() for line in nidhogg.splitlines()] nidhogg_clean = '\r\n'.join(nidhogg_lines) + '\r\n' with open('trials/nidhogg.html', 'wb') as f: f.write(b'\xef\xbb\xbf' + nidhogg_clean.encode('utf-8')) print("ニーズヘッグ征竜戦のリンク更新および正規化が完了しました。") if __name__ == '__main__': main()