From 09717d0c6787b613524c8007195815a22531dd9a Mon Sep 17 00:00:00 2001 From: xtaodada Date: Mon, 5 Feb 2024 16:09:47 +0800 Subject: [PATCH] =?UTF-8?q?xjj=20=E4=BF=AE=E5=A4=8D=20api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- xjj/main.py | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/xjj/main.py b/xjj/main.py index 6746525..e29c491 100644 --- a/xjj/main.py +++ b/xjj/main.py @@ -2,6 +2,12 @@ from pagermaid.listener import listener from pagermaid.enums import Message, AsyncClient +async def get_video_url(client: AsyncClient) -> str: + res = await client.get("https://tucdn.wpon.cn/api-girl/index.php?wpon=json", timeout=10.0) + data = res.json() + return "https:" + data["mp4"] + + @listener(command="xjj", description="小姐姐视频") async def xjj(message: Message, client: AsyncClient): if message.chat and message.chat.id == -1001441461877: @@ -10,19 +16,16 @@ async def xjj(message: Message, client: AsyncClient): return await message.edit("小姐姐视频生成中 . . .") try: - res = await client.get("https://cao3.ml/get/get1.php", timeout=10.0) - if res.status_code == 200: - url = res.text - url = url.split("?tag=")[0] - try: - await message.reply_video( - url, - quote=False, - reply_to_message_id=message.reply_to_message_id, - message_thread_id=message.message_thread_id, - ) - await message.safe_delete() - except Exception as e: - await message.edit(f"出错了呜呜呜 ~ {e.__class__.__name__}") + url = await get_video_url(client) + try: + await message.reply_video( + url, + quote=False, + reply_to_message_id=message.reply_to_message_id, + message_thread_id=message.message_thread_id, + ) + await message.safe_delete() + except Exception as e: + await message.edit(f"出错了呜呜呜 ~ {e.__class__.__name__}") except Exception as e: await message.edit(f"出错了呜呜呜 ~ {e.__class__.__name__}")