Files
ff14-guide/tools/update_castrum_abania.py
T

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>Lv69 (IL260〜)</td>
<td><strong>対応</strong></td>
<td>ギラバニア山岳地帯の帝国要塞。三属性カプセル、フォルドラ。</td>
<td>準備中</td>
</tr>"""
replacement = """ <tr>
<td><strong>巨砲要塞 カストルム・アバニア</strong></td>
<td>Lv69 (IL260〜)</td>
<td><strong>対応</strong></td>
<td>ギラバニア山岳地帯の帝国要塞。三属性カプセル、フォルドラ。</td>
<td><a href="castrum_abania.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/castrum_abania.html', 'r', encoding='utf-8-sig') as f:
cas = f.read()
cas_lines = [line.rstrip() for line in cas.splitlines()]
cas_clean = '\r\n'.join(cas_lines) + '\r\n'
with open('dungeons/castrum_abania.html', 'wb') as f:
f.write(b'\xef\xbb\xbf' + cas_clean.encode('utf-8'))
print("巨砲要塞 カストルム・アバニアのリンク更新および正規化が完了しました。")
if __name__ == '__main__':
main()