Files
ff14-guide/tools/update_malikahs_well.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>Lv77 (IL400〜)</td>
<td><strong>対応</strong></td>
<td>アム・アレーンの大水路。巨大水車、アルマジロの回転突進、ストーヴ。</td>
<td>準備中</td>
</tr>"""
replacement = """ <tr>
<td><strong>爽涼離宮 マリカの大井戸</strong></td>
<td>Lv77 (IL400〜)</td>
<td><strong>対応</strong></td>
<td>アム・アレーンの大水路。巨大水車、アルマジロの回転突進、ストーヴ。</td>
<td><a href="malikahs_well.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/malikahs_well.html', 'r', encoding='utf-8-sig') as f:
mal = f.read()
mal_lines = [line.rstrip() for line in mal.splitlines()]
mal_clean = '\r\n'.join(mal_lines) + '\r\n'
with open('dungeons/malikahs_well.html', 'wb') as f:
f.write(b'\xef\xbb\xbf' + mal_clean.encode('utf-8'))
print("爽涼離宮 マリカの大井戸のリンク更新および正規化が完了しました。")
if __name__ == '__main__':
main()