From 7321b76bb5b1e1aa4a0b3e54f6cf9b7004f5319f Mon Sep 17 00:00:00 2001 From: hotyue <52734432+hotyue@users.noreply.github.com> Date: Wed, 15 Apr 2026 04:25:25 +0000 Subject: [PATCH] =?UTF-8?q?fix(scripts):=20=E5=8D=87=E7=BA=A7=E7=83=AD?= =?UTF-8?q?=E6=90=9C=E8=AF=8D=E6=8A=93=E5=8F=96=E5=BC=95=E6=93=8E=EF=BC=8C?= =?UTF-8?q?=E9=80=82=E9=85=8D=20v3.5.0=20=E5=A4=A7=E6=B4=B2=E6=88=98?= =?UTF-8?q?=E5=8C=BA=E5=A4=9A=E5=B1=82=E7=BA=A7=E8=A7=A3=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/fetch_trends.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/scripts/fetch_trends.py b/scripts/fetch_trends.py index d4fde55..9ee954e 100644 --- a/scripts/fetch_trends.py +++ b/scripts/fetch_trends.py @@ -21,15 +21,17 @@ HEADERS = { } def get_active_regions(): - """动态提取 map.json 中的战区 (修正:精准穿透 JSON 数组结构)""" + """动态提取 map.json 中的战区 (适配 v3.5.0 大洲战区降维架构)""" try: with open(MAP_JSON_PATH, 'r', encoding='utf-8') as f: data = json.load(f) - # 穿透到 countries 列表,提取所有的国家代码 (id) regions = [] - for country in data.get('countries', []): - if 'id' in country: - regions.append(country['id']) + # 第一层穿透:遍历所有大洲战区 (continents) + for continent in data.get('continents', []): + # 第二层穿透:遍历大洲下的所有国家 (countries) + for country in continent.get('countries', []): + if 'id' in country: + regions.append(country['id']) return regions except Exception as e: print(f"❌ [读取地图失败]: {e}")