Files
ff14-guide/tools/update_ultimate_dragonsong.py

44 lines
1.8 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>Lv90 (IL605シンク)</td>
<td><strong style="color: #6f42c1;">絶 (Ultimate)</strong></td>
<td>オルシュファン救出ifルート、騎神・邪竜・二天竜・最終騎神。称号「The Dragonsong's Reprise」。</td>
<td>準備中</td>
</tr>"""
replacement = """ <tr>
<td><strong>絶竜詩戦争</strong></td>
<td>Lv90 (IL605シンク)</td>
<td><strong style="color: #6f42c1;">絶 (Ultimate)</strong></td>
<td>オルシュファン救出ifルート、騎神・邪竜・二天竜・最終騎神。称号「The Dragonsong's Reprise」。</td>
<td><a href="ultimate_dragonsong.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/ultimate_dragonsong.html', 'r', encoding='utf-8-sig') as f:
dsr = f.read()
dsr_lines = [line.rstrip() for line in dsr.splitlines()]
dsr_clean = '\r\n'.join(dsr_lines) + '\r\n'
with open('trials/ultimate_dragonsong.html', 'wb') as f:
f.write(b'\xef\xbb\xbf' + dsr_clean.encode('utf-8'))
print("絶竜詩戦争のリンク更新および正規化が完了しました。")
if __name__ == '__main__':
main()