Compare commits
3
Commits
1b3faaf925
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4ef5d5f1a7 | ||
|
|
f62a78b8ca | ||
|
|
fc3fdb4764 |
+3
-1
@@ -1,5 +1,7 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Ozon 投放表现</title>
|
||||
<html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate"><meta http-equiv="Pragma" content="no-cache"><meta http-equiv="Expires" content="0">
|
||||
<title>Ozon 投放表现</title>
|
||||
<style>
|
||||
:root{--bg:#f4f7fb;--card:#fff;--text:#14213d;--muted:#6b7280;--line:#e5eaf1;--blue:#5577ee;--green:#23a673;--pink:#e4568b}
|
||||
*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--text);font-family:Inter,"Microsoft YaHei",system-ui,sans-serif}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
24
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
||||
TMP_FILE="$SCRIPT_DIR/data.json.tmp"
|
||||
OUTPUT_FILE="$SCRIPT_DIR/data.json"
|
||||
|
||||
python3 "$SCRIPT_DIR/update_report_data.py" "$TMP_FILE"
|
||||
|
||||
mv "$TMP_FILE" "$OUTPUT_FILE"
|
||||
echo "Updated $OUTPUT_FILE"
|
||||
@@ -244,11 +244,13 @@ def build_payload(rows, now):
|
||||
def main():
|
||||
if len(sys.argv) < 2:
|
||||
raise SystemExit("用法: update_report_data.py <输出文件>")
|
||||
|
||||
now = datetime.now(TIMEZONE)
|
||||
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")
|
||||
rows = list(csv.reader(text.splitlines()))
|
||||
payload = build_payload(rows, datetime.now(TIMEZONE))
|
||||
payload = build_payload(rows, now)
|
||||
with open(sys.argv[1], "w", encoding="utf-8") as handle:
|
||||
json.dump(payload, handle, ensure_ascii=False, indent=2)
|
||||
period = payload["period"]
|
||||
|
||||
Reference in New Issue
Block a user