From 635df5cf40a027f0203495517866c6ea8b3a705a Mon Sep 17 00:00:00 2001 From: xtaodada Date: Sat, 3 Jun 2023 20:22:11 +0800 Subject: [PATCH] =?UTF-8?q?news60s=20=E4=BF=AE=E5=A4=8D=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 42 ++++++++++++++++++++++++++++++++++++++++++ news60s/main.py | 22 ++++++++++++---------- 2 files changed, 54 insertions(+), 10 deletions(-) create mode 100644 index.html diff --git a/index.html b/index.html new file mode 100644 index 0000000..e946f06 --- /dev/null +++ b/index.html @@ -0,0 +1,42 @@ + + + 无法访问! + + + + + + + + + + + + +
+ +
+
+

抱歉,您已被阻止

+
+ +
+
+
+ + + +
+
+
+
+
+ + diff --git a/news60s/main.py b/news60s/main.py index 273ca24..6f93aa0 100644 --- a/news60s/main.py +++ b/news60s/main.py @@ -3,7 +3,7 @@ from os import sep from os.path import isfile from datetime import date -from typing import Optional, Dict +from typing import Optional from pyrogram.enums.parse_mode import ParseMode from pagermaid import scheduler @@ -20,22 +20,22 @@ news60s_cache_time: Optional[date] = None async def get_news60s() -> None: global news60s_cache_time - if news60s_cache_time == date.today() and isfile(f"data{sep}news60s.jpg"): + if news60s_cache_time == date.today() and isfile(f"data{sep}news60s.png"): return - resp = await client.get("https://api.03c3.cn/zb/") + resp = await client.get("https://api.emoao.com/api/60s") if resp.is_error: raise ValueError(f"获取失败,错误码:{resp.status_code}") news60s_cache_time = date.today() - safe_remove(f"data{sep}news60s.jpg") - with open(f"data{sep}news60s.jpg", "wb") as f: + safe_remove(f"data{sep}news60s.png") + with open(f"data{sep}news60s.png", "wb") as f: f.write(resp.content) async def push_news60s(gid: int) -> None: - if isfile(f"data{sep}news60s.jpg"): + if isfile(f"data{sep}news60s.png"): await bot.send_photo( gid, - f"data{sep}news60s.jpg" + f"data{sep}news60s.png" ) @@ -49,9 +49,11 @@ async def news60s_subscribe() -> None: news60s_sub.del_id(gid) -@listener(command="news60s", - parameters="订阅/退订", - description="查看 60s 看世界新闻,支持订阅/退订每天上午八点定时发送") +@listener( + command="news60s", + parameters="订阅/退订", + description="查看 60s 看世界新闻,支持订阅/退订每天上午八点定时发送" +) async def news60s(message: Message): if not message.arguments: try: