Skip to content

Commit

Permalink
news60s 修复 api
Browse files Browse the repository at this point in the history
  • Loading branch information
omg-xtao authored Jan 7, 2024
1 parent 73dcd97 commit 8aa3690
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions news60s/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ async def get_news60s() -> None:
force_update = not isfile(CACHE_PATH)
if news60s_cache_date == today and not force_update:
return
resp = await client.get("https://api.emoao.com/api/60s?type=json")
resp = await client.get("https://api.03c3.cn/api/zb?type=jsonImg")
res = resp.json()
assert res["msg"] == "success", f"API 返回错误: {res['code']} ({res['msg']})"
news_date = datetime.strptime(res["data"]["date"], "%Y-%m-%d").date()
news_date = datetime.strptime(res["data"]["datetime"], "%Y-%m-%d").date()
if news_date == news60s_cache_date and not force_update:
return
image = await client.get(res["data"]["image"])
image = await client.get(res["data"]["imageurl"])
with open(CACHE_PATH, "wb") as fp:
fp.write(image.content)
news60s_cache_date = news_date
Expand Down

0 comments on commit 8aa3690

Please sign in to comment.