🚩 Cosplay meizi - More api (#9)

This commit is contained in:
AAA 2020-08-23 22:54:48 +08:00 committed by GitHub
parent b6152ee0e1
commit b44f5aa811
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 120 additions and 0 deletions

49
cosplay-multi.py Normal file
View File

@ -0,0 +1,49 @@
from random import randint
from time import sleep
from requests import get
from pagermaid.listener import listener
from os import remove
@listener(is_plugin=True, outgoing=True, command="cosm",
description="多网站随机获取cosplay图片会自动重试哦")
async def joke(context):
await context.edit("获取中 . . .")
status = False
for _ in range (20): #最多重试20次
website = randint(0, 4)
if website == 0:
img = get("https://api.helloworld.la/xiezhen_cosplay.php")
elif website == 1:
img = get("https://api.vvhan.com/api/mobil.girl?type=json")
elif website == 2:
img = get("https://api.helloworld.la/xiezhen_weimei.php")
elif website == 3:
img = get("http://api.rosysun.cn/cos")
elif website == 4:
img = get("https://uploadbeta.com/api/pictures/random/?key=%E5%8A%A8%E6%BC%AB")
if img.status_code == 200:
if website == 3:
img = get(img.content)
if img.status_code != 200:
continue #再试一次
with open(r'tu.png', 'wb') as f:
await context.edit("正在上传图片")
f.write(img.content)
await context.client.send_file(
context.chat_id,
"tu.png",
reply_to=None,
caption=None
)
try:
remove('tu.png')
except:
pass
status = True
break #成功了就赶紧结束啦!
if not status:
await context.edit("出错了呜呜呜 ~ 试了好多好多次都无法访问到 API 服务器 。")
sleep(2)
await context.delete()

View File

@ -209,6 +209,26 @@
"supported": false,
"des-short": "生成一张 吃头像 图片。",
"des": "这个人很懒,什么都没有留下。"
},
{
"name": "cosplay-multi",
"version": "1.0",
"section": "profile",
"maintainer": "TNTcraftHIM",
"size": "1.8 kb",
"supported": true,
"des-short": "多网站随机获取Cos图",
"des": "在不同的几个网站中随机获取Cosplay图片解决了cosplay单个API流量用尽后无法获取的问题。命令cosm。"
},
{
"name": "meizi",
"version": "1.0",
"section": "profile",
"maintainer": "TNTcraftHIM",
"size": "2.0 kb",
"supported": true,
"des-short": "多网站随机获取写真",
"des": "从不同的网站中调取妹子写真但是无漏点放心使用安全版ghs。命令meizi。"
}
]
}

51
meizi.py Normal file
View File

@ -0,0 +1,51 @@
from random import randint
from time import sleep
from requests import get
from pagermaid.listener import listener
from os import remove
@listener(is_plugin=True, outgoing=True, command="meizi",
description="多网站随机获取性感(可能)的写真")
async def joke(context):
await context.edit("获取中 . . .")
status = False
for _ in range (20): #最多重试20次
website = randint(0, 7)
if website == 0:
img = get("https://mm.52.mk")
elif website == 1:
img = get("https://api.helloworld.la/xiezhen_xinggan.php")
elif website == 2:
img = get("https://api.helloworld.la/bizhi_meizi.php")
elif website == 3:
img = get("https://uploadbeta.com/api/pictures/random/?key=%E5%A4%A7%E5%B0%BA%E5%BA%A6")
elif website == 4:
img = get("https://cdn.seovx.com/?mom=302")
elif website == 5:
img = get("https://uploadbeta.com/api/pictures/random/?key=%E5%A6%B9%E5%AD%90")
elif website == 6:
img = get("https://uploadbeta.com/api/pictures/random/?key=%E6%8E%A8%E5%A5%B3%E9%83%8E")
elif website == 7:
img = get("https://uploadbeta.com/api/pictures/random/?key=%E5%A5%B3%E7%A5%9E")
if img.status_code == 200:
with open(r'tu.png', 'wb') as f:
await context.edit("正在上传图片")
f.write(img.content)
await context.client.send_file(
context.chat_id,
"tu.png",
reply_to=None,
caption=None
)
try:
remove('tu.png')
except:
pass
status = True
break #成功了就赶紧结束啦!
if not status:
await context.edit("出错了呜呜呜 ~ 试了好多好多次都无法访问到 API 服务器(没有妹子看啦!) 。")
sleep(2)
await context.delete()