feat: 暁月メインダンジョン「異形楼閣 ゾットの塔」完全攻略ページの作成と一覧リンク更新

This commit is contained in:
armonica committed 2026-10-29 13:13:40 +09:00
1 parent 261d4c5af3
commit 73035d26e0
3 files changed
+312 -7

No files matched your search

+6 -6
View File
@@ -26,21 +26,21 @@ def normalize_file(path):
f.write(b'\xef\xbb\xbf' + final_text.encode('utf-8'))
print(f"Normalized {path}")
def update_dungeon_entry_exact(name_exact, url):
def update_dungeon_entry_contains(keyword, url):
path_idx = 'dungeons/index.html'
with open(path_idx, 'rb') as f:
c = f.read().decode('utf-8', errors='ignore')
if f'href="{url}"' not in c:
c = c.replace('\r\n', '\n')
pattern = rf'(<td><strong>{re.escape(name_exact)}</strong></td>.*?<td>)準備中(</td>)'
pattern = rf'(<td><strong>.*?{re.escape(keyword)}.*?</strong></td>.*?<td>)準備中(</td>)'
c = re.sub(pattern, rf'\g<1><a href="{url}">攻略を見る ➜</a>\2', c, count=1, flags=re.DOTALL)
with open(path_idx, 'wb') as f:
f.write(c.encode('utf-8'))
normalize_file(path_idx)
print(f"Updated {name_exact} in {path_idx}")
print(f"Updated {keyword} in {path_idx}")
else:
print(f"Already updated {name_exact}")
print(f"Already updated {keyword}")
if __name__ == '__main__':
normalize_file('dungeons/praetorium.html')
update_dungeon_entry_exact('最終決戦 魔導城プラエトリウム', 'praetorium.html')
normalize_file('dungeons/tower_of_zot.html')
update_dungeon_entry_contains('ゾットの塔', 'tower_of_zot.html')