Files
Gloria/check_2026_01.py

96 lines
3.1 KiB
Python

"""直接从Confluence API获取2026.01页面的子页面"""
import asyncio
import sys
sys.path.insert(0, '.')
from confluence.client import ConfluenceClient
async def check_2026_01_children():
"""检查2026.01页面的所有子页面"""
print("=" * 60)
print("🔍 重新获取2026.01页面的子页面")
print("=" * 60)
client = ConfluenceClient()
# 2026.01 页面ID: 159049201
page_id = "159049201"
try:
children = await client.get_children(page_id)
print(f"\n📄 找到 {len(children)} 个子页面\n")
# 按标题排序
sorted_children = sorted(children, key=lambda x: x.get('title', ''))
print("所有子页面标题:")
print("-" * 60)
for i, child in enumerate(sorted_children, 1):
title = child.get('title', 'N/A')
child_id = child.get('id', 'N/A')
print(f"{i:3d}. {title} (ID: {child_id})")
# 检查是否包含353-360
if any(f'FZ {n}#' in title for n in range(353, 361)):
print(f" ⭐ 找到353-360范围内的船次!")
# 特别查找353-360
print("\n" + "=" * 60)
print("🔎 特别查找 FZ 353# 到 FZ 360#:")
print("=" * 60)
found_ships = []
for child in children:
title = child.get('title', '')
if 'FZ ' in title:
try:
# 提取船次数字
import re
match = re.search(r'FZ\s+(\d+)#', title)
if match:
num = int(match.group(1))
if 353 <= num <= 360:
found_ships.append((num, title, child.get('id')))
except:
pass
if found_ships:
print(f"\n✅ 找到 {len(found_ships)} 艘船 (353-360#):")
for num, title, child_id in sorted(found_ships):
print(f" {title} (ID: {child_id})")
else:
print("\n❌ 未找到353-360#范围内的船次")
# 显示350#之后的船次
print("\n" + "=" * 60)
print("📊 350#之后的所有船次:")
print("=" * 60)
ships_after_350 = []
for child in children:
title = child.get('title', '')
if 'FZ ' in title:
try:
import re
match = re.search(r'FZ\s+(\d+)#', title)
if match:
num = int(match.group(1))
if num >= 350:
ships_after_350.append((num, title, child.get('id')))
except:
pass
ships_after_350.sort()
for num, title, child_id in ships_after_350:
print(f" {title}")
except Exception as e:
print(f"\n❌ 错误: {e}")
import traceback
traceback.print_exc()
finally:
await client.close()
if __name__ == "__main__":
asyncio.run(check_2026_01_children())