Files
ff14-guide/tools/update_thordan.py

44 lines
1.7 KiB
Python

import sys
def main():
with open('trials/index.html', 'r', encoding='utf-8-sig') as f:
content = f.read()
target = """ <tr>
<td><strong>ナイツ・オブ・ラウンド / 極ナイツ</strong></td>
<td>Lv60 (IL142〜/205〜)</td>
<td>ノーマル / 極</td>
<td><strong>【蒼天ラスボス】</strong> 騎神トールダンと蒼天騎士団の怒涛の連係。</td>
<td>準備中</td>
</tr>"""
replacement = """ <tr>
<td><strong>ナイツ・オブ・ラウンド / 極ナイツ</strong></td>
<td>Lv60 (IL142〜/205〜)</td>
<td>ノーマル / 極</td>
<td><strong>【蒼天ラスボス】</strong> 騎神トールダンと蒼天騎士団の怒涛の連係。</td>
<td><a href="thordan.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('trials/index.html', 'wb') as f:
f.write(b'\xef\xbb\xbf' + content_clean.encode('utf-8'))
with open('trials/thordan.html', 'r', encoding='utf-8-sig') as f:
thordan = f.read()
thordan_lines = [line.rstrip() for line in thordan.splitlines()]
thordan_clean = '\r\n'.join(thordan_lines) + '\r\n'
with open('trials/thordan.html', 'wb') as f:
f.write(b'\xef\xbb\xbf' + thordan_clean.encode('utf-8'))
print("トールダン討滅戦のリンク更新および正規化が完了しました。")
if __name__ == '__main__':
main()