xjj 修复 api

This commit is contained in:
xtaodada 2024-02-05 16:09:47 +08:00
parent e3193b83ed
commit 09717d0c67
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659

View File

@ -2,6 +2,12 @@ from pagermaid.listener import listener
from pagermaid.enums import Message, AsyncClient 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="小姐姐视频") @listener(command="xjj", description="小姐姐视频")
async def xjj(message: Message, client: AsyncClient): async def xjj(message: Message, client: AsyncClient):
if message.chat and message.chat.id == -1001441461877: if message.chat and message.chat.id == -1001441461877:
@ -10,19 +16,16 @@ async def xjj(message: Message, client: AsyncClient):
return return
await message.edit("小姐姐视频生成中 . . .") await message.edit("小姐姐视频生成中 . . .")
try: try:
res = await client.get("https://cao3.ml/get/get1.php", timeout=10.0) url = await get_video_url(client)
if res.status_code == 200: try:
url = res.text await message.reply_video(
url = url.split("?tag=")[0] url,
try: quote=False,
await message.reply_video( reply_to_message_id=message.reply_to_message_id,
url, message_thread_id=message.message_thread_id,
quote=False, )
reply_to_message_id=message.reply_to_message_id, await message.safe_delete()
message_thread_id=message.message_thread_id, except Exception as e:
) await message.edit(f"出错了呜呜呜 ~ {e.__class__.__name__}")
await message.safe_delete()
except Exception as e:
await message.edit(f"出错了呜呜呜 ~ {e.__class__.__name__}")
except Exception as e: except Exception as e:
await message.edit(f"出错了呜呜呜 ~ {e.__class__.__name__}") await message.edit(f"出错了呜呜呜 ~ {e.__class__.__name__}")