From 4ef5d5f1a77eea1c33e092c010e6e040831d68f1 Mon Sep 17 00:00:00 2001 From: SHAREit Date: Thu, 27 Aug 2026 11:40:28 +0800 Subject: [PATCH] Refresh report data (manual update) --- schedule.conf | 1 - update.sh | 17 ----------------- update_report_data.py | 9 +-------- 3 files changed, 1 insertion(+), 26 deletions(-) delete mode 100644 schedule.conf delete mode 100644 update.sh diff --git a/schedule.conf b/schedule.conf deleted file mode 100644 index f33dfa2..0000000 --- a/schedule.conf +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/update.sh b/update.sh deleted file mode 100644 index 1a12100..0000000 --- a/update.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -set -eu - -# 平台按 schedule.conf 每小时执行;脚本内部只在北京时间 11 点真正写入数据。 -SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) -TMP_FILE="$SCRIPT_DIR/data.json.tmp" -OUTPUT_FILE="$SCRIPT_DIR/data.json" - -rm -f "$TMP_FILE" -python3 "$SCRIPT_DIR/update_report_data.py" "$TMP_FILE" "$@" - -if [ -f "$TMP_FILE" ]; then - mv "$TMP_FILE" "$OUTPUT_FILE" - echo "Updated $OUTPUT_FILE" -else - echo "Skipped: not the scheduled update hour" -fi diff --git a/update_report_data.py b/update_report_data.py index 7ae8293..cd204c5 100644 --- a/update_report_data.py +++ b/update_report_data.py @@ -23,8 +23,6 @@ CSV_URL = ( ) TIMEZONE = ZoneInfo("Asia/Shanghai") COUNTRIES = ["KZ", "UZ", "KG", "AM"] -# 平台只支持“每隔几小时”,因此按小时调度,仅在此时刻真正更新(Asia/Shanghai) -UPDATE_HOUR = 11 DATE_HEADERS = {"date"} GEO_HEADERS = {"geo", "country"} @@ -245,14 +243,9 @@ def build_payload(rows, now): def main(): if len(sys.argv) < 2: - raise SystemExit("用法: update_report_data.py <输出文件> [--force]") + raise SystemExit("用法: update_report_data.py <输出文件>") now = datetime.now(TIMEZONE) - forced = "--force" in sys.argv[2:] - if not forced and now.hour != UPDATE_HOUR: - print(f"SKIP {now:%Y-%m-%d %H:%M} 非 {UPDATE_HOUR}:00(Asia/Shanghai),不更新") - return - request = urllib.request.Request(CSV_URL, headers={"User-Agent": "AgentStage-Ozon-Report/2.0"}) with urllib.request.urlopen(request, timeout=90) as response: text = response.read().decode("utf-8-sig")