|
|
@@ -347,6 +347,7 @@ def get_video(log, good_code: str, play_code: str) -> str | None:
|
|
|
body = {"playCode": play_code, "sign": kj_auth.video_sign(ts, good_code, play_code), "ts": ts}
|
|
|
j = kj_request(log, f"good/videoPlay/{good_code}", method="POST", base=SERVER_BASE,
|
|
|
json_body=body, need_auth=False, extra_headers={"Content-Type": "application/json"})
|
|
|
+ print(j)
|
|
|
return (j or {}).get("media_url") if j and j.get("code") == 0 else None
|
|
|
|
|
|
|
|
|
@@ -371,6 +372,9 @@ def build_product(good_item: dict, detail_good: dict, merchant_code: str, mercha
|
|
|
|
|
|
# 拼团系列 / 拼团时间(天):从 detail.good.desc 解码提取
|
|
|
group_series, group_days = parse_desc(detail_good.get("desc", ""))
|
|
|
+ # print(good_item)
|
|
|
+ # print('------------------------------')
|
|
|
+ # print(detail_good)
|
|
|
|
|
|
row = {
|
|
|
"shop_id": merchant_code, # 商户编码
|
|
|
@@ -390,6 +394,7 @@ def build_product(good_item: dict, detail_good: dict, merchant_code: str, mercha
|
|
|
"group_days": group_days, # 拼团时间(天),如 15
|
|
|
# "publisher_sale": detail_good.get("publisher", {}).get("sale"), # 在售
|
|
|
# "publisher_fans": detail_good.get("publisher", {}).get("fans"), # 出售者粉丝
|
|
|
+ "live_start_at": ts_to_dt((detail_good.get("broadcast") or {}).get("startAt")),
|
|
|
"video_url": video_url,
|
|
|
}
|
|
|
return row
|
|
|
@@ -729,7 +734,7 @@ def kj_main(log):
|
|
|
def schedule_task():
|
|
|
"""定时任务入口:每天 00:01 运行一次 kj_main。"""
|
|
|
# 立即运行一次(调试时取消注释)
|
|
|
- kj_main(log=logger)
|
|
|
+ # kj_main(log=logger)
|
|
|
|
|
|
schedule.every().day.at("00:01").do(kj_main, log=logger)
|
|
|
while True:
|