Files
ff14-guide/tools/update_sirensong_sea.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>Lv61 (IL240〜)</td>
<td><strong>対応</strong></td>
<td>ひんがしの国へ向かう幽霊船航路。船幽霊の呪縛、セイレーンの魅了歌。</td>
<td>準備中</td>
</tr>"""
replacement = """ <tr>
<td><strong>漂流海域 セイレーン海</strong></td>
<td>Lv61 (IL240〜)</td>
<td><strong>対応</strong></td>
<td>ひんがしの国へ向かう幽霊船航路。船幽霊の呪縛、セイレーンの魅了歌。</td>
<td><a href="sirensong_sea.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/sirensong_sea.html', 'r', encoding='utf-8-sig') as f:
sir = f.read()
sir_lines = [line.rstrip() for line in sir.splitlines()]
sir_clean = '\r\n'.join(sir_lines) + '\r\n'
with open('dungeons/sirensong_sea.html', 'wb') as f:
f.write(b'\xef\xbb\xbf' + sir_clean.encode('utf-8'))
print("漂流海域 セイレーン海のリンク更新および正規化が完了しました。")
if __name__ == '__main__':
main()