# -*- coding: utf-8 -*- import sys def normalize_file(filepath): with open(filepath, 'r', encoding='utf-8') as f: content = f.read() content = content.lstrip('\ufeff') lines = [line.rstrip() for line in content.splitlines()] norm_lines = [] prev_blank = False for line in lines: if line == '': if not prev_blank: norm_lines.append(line) prev_blank = True else: norm_lines.append(line) prev_blank = False result = '\r\n'.join(norm_lines) + '\r\n' with open(filepath, 'wb') as f: f.write(b'\xef\xbb\xbf' + result.encode('utf-8')) normalize_file('raids/ridorana.html') with open('raids/index.html', 'r', encoding='utf-8') as f: text = f.read() # リドルアナ更新 target_ridorana = """ 封じられた聖塔 リドルアナ Lv70 (紅蓮4.x) 24人 (A/B/C) ファムフリート、ベリアス(時間停止)、労働八号(算数ギミック素数計算)、鬼龍ヤズマット。 準備中 """ replacement_ridorana = """ 封じられた聖塔 リドルアナ Lv70 (紅蓮4.x) 24人 (A/B/C) ファムフリート、ベリアス(時間停止)、労働八号(算数ギミック素数計算)、鬼龍ヤズマット。 攻略を見る ➜ """ # クルーザー級・ヘビー級更新 target_cruiser = """ クルーザー級(1〜4層) Lv100 (パッチ7.2) ノーマル / 零式 パッチ7.2実装予定。第2弾レイドシリーズ。 準備中 ヘビー級(1〜4層) Lv100 (パッチ7.4) ノーマル / 零式 パッチ7.4実装予定。アルカディア完結編。 準備中 """ replacement_cruiser = """ クルーザー級(1〜4層) Lv100 (パッチ7.2) ノーマル / 零式 パッチ7.2実装予定。第2弾レイドシリーズ。 パッチ7.2実装予定 ヘビー級(1〜4層) Lv100 (パッチ7.4) ノーマル / 零式 パッチ7.4実装予定。アルカディア完結編。 パッチ7.4実装予定 """ if target_ridorana in text: text = text.replace(target_ridorana, replacement_ridorana) print("SUCCESS: Target ridorana found and replaced") else: print("ERROR: target_ridorana not found") if target_cruiser in text: text = text.replace(target_cruiser, replacement_cruiser) print("SUCCESS: Target cruiser found and replaced") else: print("ERROR: target_cruiser not found") with open('raids/index.html', 'w', encoding='utf-8') as f: f.write(text) normalize_file('raids/index.html') print("Successfully processed raids/index.html")