Files
ff14-guide/tools/update_bardams_mettle.py

44 lines
1.7 KiB
Python

import sys
def main():
with open('dungeons/index.html', 'r', encoding='utf-8-sig') as f:
content = f.read()
target = """ <tr>
<td><strong>伝統試練 バルダム覇道</strong></td>
<td>Lv65 (IL250〜)</td>
<td><strong>対応</strong></td>
<td>アジムステップの試練。ボス2は「攻撃禁止・ギミック回避専念テスト」。</td>
<td>準備中</td>
</tr>"""
replacement = """ <tr>
<td><strong>伝統試練 バルダム覇道</strong></td>
<td>Lv65 (IL250〜)</td>
<td><strong>対応</strong></td>
<td>アジムステップの試練。ボス2は「攻撃禁止・ギミック回避専念テスト」。</td>
<td><a href="bardams_mettle.html">攻略を見る ➜</a></td>
</tr>"""
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/bardams_mettle.html', 'r', encoding='utf-8-sig') as f:
bar = f.read()
bar_lines = [line.rstrip() for line in bar.splitlines()]
bar_clean = '\r\n'.join(bar_lines) + '\r\n'
with open('dungeons/bardams_mettle.html', 'wb') as f:
f.write(b'\xef\xbb\xbf' + bar_clean.encode('utf-8'))
print("伝統試練 バルダム覇道のリンク更新および正規化が完了しました。")
if __name__ == '__main__':
main()