feat: クリスタルタワー: 闇の世界 完全攻略ページの作成およびリンク追加
This commit is contained in:
1 parent
f7271f4633
commit
e7312ea90e
5 files changed
+342
-14
No files matched your search
+25
-13
@@ -22,39 +22,51 @@ def clean_and_save(path, content):
|
||||
with open(path, 'wb') as f:
|
||||
f.write(b'\xef\xbb\xbf' + text.encode('utf-8'))
|
||||
|
||||
def update_syrcus_tower():
|
||||
def update_world_of_darkness():
|
||||
# 1. raids/index.html
|
||||
path_idx = 'raids/index.html'
|
||||
with open(path_idx, 'rb') as f:
|
||||
c = f.read().decode('utf-8', errors='ignore')
|
||||
if 'href="syrcus_tower.html"' not in c:
|
||||
if 'href="world_of_darkness.html"' not in c:
|
||||
c = c.replace('\r\n', '\n')
|
||||
c = re.sub(r'(シルクスの塔</strong>.*?<td>)準備中(</td>)', r'\1<a href="syrcus_tower.html">攻略を見る ➜</a>\2', c, flags=re.DOTALL)
|
||||
target = '<td><a href="syrcus_tower.html">攻略を見る ➜</a></td>\n </tr>'
|
||||
new_row = '''<td><a href="syrcus_tower.html">攻略を見る ➜</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>クリスタルタワー:<br>闇の世界</strong></td>
|
||||
<td>Lv50 (新生2.x / メイン必須)</td>
|
||||
<td><strong>【全滅多発難関レイド】</strong> アンラ・マンユ(死の視線)、ケルベロス(胃袋突入・鎖繋ぎ)、暗闇の雲。</td>
|
||||
<td><a href="world_of_darkness.html">攻略を見る ➜</a></td>
|
||||
</tr>'''
|
||||
if target in c:
|
||||
c = c.replace(target, new_row)
|
||||
else:
|
||||
c = re.sub(r'(<td><a href="syrcus_tower\.html">.*?</td>\s*</tr>)', r'\1\n <tr>\n <td><strong>クリスタルタワー:<br>闇の世界</strong></td>\n <td>Lv50 (新生2.x / メイン必須)</td>\n <td><strong>【全滅多発難関レイド】</strong> アンラ・マンユ(死の視線)、ケルベロス(胃袋突入・鎖繋ぎ)、暗闇の雲。</td>\n <td><a href="world_of_darkness.html">攻略を見る ➜</a></td>\n </tr>', c)
|
||||
clean_and_save(path_idx, c)
|
||||
print("Updated syrcus_tower in raids/index.html")
|
||||
print("Updated world_of_darkness in raids/index.html")
|
||||
|
||||
# 2. common/sidebar.html
|
||||
path_sb = 'common/sidebar.html'
|
||||
with open(path_sb, 'rb') as f:
|
||||
c = f.read().decode('utf-8', errors='ignore')
|
||||
new_sb = '<li><a href="../raids/syrcus_tower.html">シルクスの塔 (Lv50)</a></li>'
|
||||
new_sb = '<li><a href="../raids/world_of_darkness.html">闇の世界 (Lv50)</a></li>'
|
||||
if new_sb not in c:
|
||||
c = c.replace('\r\n', '\n')
|
||||
c = re.sub(r'(<li><a href="\.\./raids/labyrinth_of_ancients\.html">.*?</li>)', r'\1\n ' + new_sb, c)
|
||||
c = re.sub(r'(<li><a href="\.\./raids/syrcus_tower\.html">.*?</li>)', r'\1\n ' + new_sb, c)
|
||||
clean_and_save(path_sb, c)
|
||||
print("Added syrcus_tower to common/sidebar.html")
|
||||
print("Added world_of_darkness to common/sidebar.html")
|
||||
|
||||
# 3. common/js/wiki_common.js
|
||||
path_js = 'common/js/wiki_common.js'
|
||||
with open(path_js, 'rb') as f:
|
||||
c = f.read().decode('utf-8', errors='ignore')
|
||||
new_js = "{ text: 'シルクスの塔 (Lv50)', path: 'raids/syrcus_tower.html' }"
|
||||
if 'syrcus_tower.html' not in c:
|
||||
new_js = "{ text: '闇の世界 (Lv50)', path: 'raids/world_of_darkness.html' }"
|
||||
if 'world_of_darkness.html' not in c:
|
||||
c = c.replace('\r\n', '\n')
|
||||
c = re.sub(r"(\{ text: '古代の民の迷宮 \(Lv50\)', path: 'raids/labyrinth_of_ancients\.html' \})", r"\1,\n " + new_js, c)
|
||||
c = re.sub(r"(\{ text: 'シルクスの塔 \(Lv50\)', path: 'raids/syrcus_tower\.html' \})", r"\1,\n " + new_js, c)
|
||||
clean_and_save(path_js, c)
|
||||
print("Added syrcus_tower to common/js/wiki_common.js")
|
||||
print("Added world_of_darkness to common/js/wiki_common.js")
|
||||
|
||||
if __name__ == '__main__':
|
||||
clean_and_save('raids/syrcus_tower.html', open('raids/syrcus_tower.html', 'r', encoding='utf-8', errors='ignore').read())
|
||||
update_syrcus_tower()
|
||||
clean_and_save('raids/world_of_darkness.html', open('raids/world_of_darkness.html', 'r', encoding='utf-8', errors='ignore').read())
|
||||
update_world_of_darkness()
|
||||
Reference in new issue
Block a user