格雷Z洋洋 2 лет назад
Родитель
Сommit
266713a324

+ 1 - 1
sheepBot/src/plugins/60s News/config.py

@@ -22,4 +22,4 @@ class Config(BaseModel, extra=Extra.ignore):
     news60s_reminder_groups: list = ["605613804", "703502878"]
 
     # 定时提醒时间
-    news60s_reminder_time: list = ["08:00"]
+    news60s_reminder_time: list = ["08:00", "12:00", "19:00", "21:00"]

+ 7 - 7
sheepBot/src/plugins/60s News/data_source.py

@@ -13,20 +13,21 @@
 """
 import aiohttp
 import asyncio
+import base64
 from nonebot import logger
 
 Headers = {
     "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
 }
 
-URL = "https://api.emoao.com/api/60s?type=json"
+URL = "https://v.api.aa1.cn/api/60s-v3/?cc=国内要闻"
 
 
 async def fetch_final_url(url: str) -> str:
     """获取直到不再跳转的url链接"""
     async with aiohttp.ClientSession() as session:
         while True:
-            async with session.get(url, allow_redirects=False) as response:
+            async with session.get(url, headers=Headers, timeout=5, allow_redirects=False) as response:
                 if response.status == 200:
                     return response.url.human_repr()
                 elif response.status in [301, 302, 303, 307, 308]:
@@ -40,11 +41,10 @@ async def fetch_final_url(url: str) -> str:
 async def get_60sNews() -> str:
     try:
         async with aiohttp.ClientSession() as session:
-            async with session.get(url=URL, headers=Headers, timeout=5) as response:
-                res = await response.json(content_type=None)
-                data = res["data"]
-                img_url = await fetch_final_url(data["image"])
-                msg = f'[CQ:image,file={img_url},subType=0,cache=0]'
+            async with session.get(url=URL, headers=Headers, timeout=5, verify_ssl=False) as response:
+                data = await response.read()
+                data = base64.b64encode(data).decode("ascii")
+                msg = f'[CQ:image,file=base64://{data},subType=0]'
                 logger.debug(msg)
                 return msg
     except:

+ 7 - 4
sheepBot/src/plugins/moyu_calendar/data_source.py

@@ -13,6 +13,7 @@
 """
 import aiohttp
 import asyncio
+import datetime
 from nonebot import logger
 from nonebot.adapters.onebot.v11 import MessageSegment
 
@@ -20,7 +21,7 @@ Headers = {
     "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
 }
 
-URL = "https://api.emoao.com/api/moyu?type=json"
+URL = "https://api.j4u.ink/v1/store/other/proxy/remote/moyu.json"
 
 
 async def fetch_final_url(url: str) -> str:
@@ -43,9 +44,11 @@ async def get_moyu() -> str:
         async with aiohttp.ClientSession() as session:
             async with session.get(url=URL, headers=Headers, timeout=5) as response:
                 res = await response.json(content_type=None)
-                title = res["title"]
-                img_url = await fetch_final_url(res["imgurl"])
-                msg = f'{title}\n\n{MessageSegment.image(img_url)}'
+                now = datetime.datetime.now()
+                day = now.strftime("%Y年%m月%d日")
+                data = res["data"]
+                img_url = await fetch_final_url(data["moyu_url"])
+                msg = f'[摸鱼人日历]{day} 今天你摸鱼了吗?\n\n{MessageSegment.image(img_url)}'
                 logger.debug(msg)
                 return msg
     except:

+ 6 - 5
sheepBot/src/plugins/today_in_history/data_source.py

@@ -13,13 +13,14 @@
 """
 import aiohttp
 import asyncio
+import datetime
 from nonebot import logger
 
 Headers = {
     "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
 }
 
-URL = "https://api.emoao.com/api/lsjr"
+URL = "https://v2.api-m.com/api/history"
 
 
 async def get_today_in_history() -> str:
@@ -27,13 +28,13 @@ async def get_today_in_history() -> str:
         async with aiohttp.ClientSession() as session:
             async with session.get(url=URL, headers=Headers, timeout=5) as response:
                 res = await response.json(content_type=None)
-                day = res["day"]
-                results = res["result"]
+                now = datetime.datetime.now()
+                day = now.strftime("%Y年%m月%d日")
+                results = res["data"]
                 msg = f'今天是:{day}\n\n\n'
                 interval = len(results) - 1
                 count = 0
-                for element in results:
-                    line = f'{element["year"]} - {element["title"]}'
+                for line in results:
                     msg = msg + line
                     count += 1
                     if count <= interval: