ACGM,COSM,MEIZI插件全部更新失败重试与多线程支持! (#54)

Co-authored-by: TNTcraftHIM <TNTcraftHIM@users.noreply.github.com>
This commit is contained in:
AAA 2020-09-02 15:50:01 +08:00 committed by GitHub
parent 9f77729541
commit 75a8e46635
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 141 additions and 131 deletions

View File

@ -12,43 +12,46 @@ async def joke(context):
await context.edit("获取中 . . .")
status = False
for _ in range (20): #最多重试20次
website = random.randint(0, 5)
if website == 0:
img = requests.get("http://api.btstu.cn/sjbz/?lx=m_dongman")
elif website == 1:
img = requests.get("https://acg.yanwz.cn/api.php")
elif website == 2:
img = requests.get("https://img.xjh.me/random_img.php?type=bg&ctype=acg&return=302&device=mobile")
elif website == 3:
img = requests.get("https://www.yunboys.cn/sjbz/api.php?method=mobile&lx=dongman")
elif website == 4:
headers = {'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36 Edge/15.15063','Referer':'https://osk.soloop.ooo/give_me_eropics-l/'}
img = requests.get("https://osk.soloop.ooo/rdm.php?"+ str(random.random()), headers=headers)
elif website == 5:
img = requests.get('https://api.lolicon.app/setu/?r18=0')
if img.status_code == 200:
if website == 5:
tmp = json.loads(img.content)
img = tmp['data'][0]['url']
img = requests.get(img)
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 #成功了就赶紧结束啦!
website = random.randint(0, 6)
filename = str(random.random()) + ".png"
try:
if website == 0:
img = requests.get("http://api.btstu.cn/sjbz/?lx=m_dongman")
elif website == 1:
img = requests.get("https://acg.yanwz.cn/api.php")
elif website == 2:
img = requests.get("https://img.xjh.me/random_img.php?type=bg&ctype=acg&return=302&device=mobile")
elif website == 3:
img = requests.get("https://www.yunboys.cn/sjbz/api.php?method=mobile&lx=dongman")
elif website == 4:
headers = {'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36 Edge/15.15063','Referer':'https://osk.soloop.ooo/give_me_eropics-l/'}
img = requests.get("https://osk.soloop.ooo/rdm.php?"+ str(random.random()), headers=headers)
elif website == 5:
img = requests.get('https://api.lolicon.app/setu/?r18=0')
if img.status_code == 200:
if website == 5:
tmp = json.loads(img.content)
img = tmp['data'][0]['url']
img = requests.get(img)
if img.status_code != 200:
continue #如果返回不正常就赶紧下一回
with open(filename, 'wb') as f:
await context.edit("上传中 . . .")
f.write(img.content)
await context.client.send_file(
context.chat_id,
filename,
reply_to=None,
caption=None
)
try:
remove(filename)
except:
pass
status = True
break #成功了就赶紧结束啦!
except:
continue
if not status:
await context.edit("出错了呜呜呜 ~ 试了好多好多次都无法访问到 API 服务器 。")
sleep(2)

View File

@ -1,4 +1,4 @@
from random import randint
from random import randint, random
from time import sleep
from requests import get
from pagermaid.listener import listener
@ -12,41 +12,44 @@ async def joke(context):
status = False
for _ in range (20): #最多重试20次
website = randint(0, 6)
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")
elif website == 5:
img = get("https://uploadbeta.com/api/pictures/random/?key=%E4%BA%8C%E6%AC%A1%E5%85%83")
elif website == 6:
img = get("https://xn--wcs142h.herokuapp.com/")
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 #成功了就赶紧结束啦!
filename = str(random()) + ".png"
try:
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")
elif website == 5:
img = get("https://uploadbeta.com/api/pictures/random/?key=%E4%BA%8C%E6%AC%A1%E5%85%83")
elif website == 6:
img = get("https://xn--wcs142h.herokuapp.com/")
if img.status_code == 200:
if website == 3:
img = get(img.content)
if img.status_code != 200:
continue #再试一次
with open(filename, 'wb') as f:
await context.edit("上传中 . . .")
f.write(img.content)
await context.client.send_file(
context.chat_id,
filename,
reply_to=None,
caption=None
)
try:
remove(filename)
except:
pass
status = True
break #成功了就赶紧结束啦!
except:
continue
if not status:
await context.edit("出错了呜呜呜 ~ 试了好多好多次都无法访问到 API 服务器 。")
sleep(2)

View File

@ -212,30 +212,30 @@
},
{
"name": "cosplay-multi",
"version": "1.1",
"section": "profile",
"version": "1.2",
"section": "daily",
"maintainer": "TNTcraftHIM",
"size": "2.0 kb",
"size": "2.2 kb",
"supported": true,
"des-short": "多网站随机获取Cos图",
"des": "在不同的几个网站中随机获取Cosplay图片解决了cosplay单个API流量用尽后无法获取的问题。命令cosm。"
},
{
"name": "meizi",
"version": "1.5",
"section": "profile",
"version": "1.6",
"section": "daily",
"maintainer": "TNTcraftHIM",
"size": "3.7 kb",
"size": "4.0 kb",
"supported": true,
"des-short": "多网站随机获取写真",
"des": "从不同的网站中调取妹子写真/视频但是无漏点放心使用安全版ghs。命令mzsp。"
},
{
"name": "acg-multi",
"version": "1.2",
"section": "profile",
"version": "1.3",
"section": "daily",
"maintainer": "TNTcraftHIM",
"size": "2.3 kb",
"size": "2.5 kb",
"supported": true,
"des-short": "多网站随机获取ACG图",
"des": "从几个不同的图库中随机获取二刺螈bushiACG图片基本都是手机尺寸的图。命令acgm。"

102
meizi.py
View File

@ -12,51 +12,54 @@ async def mz(context):
status = False
for _ in range (20): #最多重试20次
website = random.randint(0, 13)
if website == 0:
img = get("https://mm.52.mk/img")
elif website == 1:
img = get("https://api.helloworld.la/xiezhen_xinggan.php")
elif website == 2:
img = get("https://api.66mz8.com/api/rand.tbimg.php")
elif website == 3:
img = get("https://api.isoyu.com/mm_images.php")
elif website == 4:
img = get("https://uploadbeta.com/api/pictures/random/?key=%E5%A5%B3")
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=%E7%BE%8E%E5%A5%B3")
elif website == 8:
img = get("https://api.diskgirl.com/image/api.php?t=xinggan&v=" + str(random.uniform(0, 100)))
elif website == 9:
img = get("https://api.lyiqk.cn/sexylady")
elif website == 10:
img = get("https://api.pingping6.com/tools/acg3/index.php")
elif website == 11:
img = get("https://api.uomg.com/api/rand.img3")
elif website == 12:
img = get("https://api.diskgirl.com/image/api.php?t=&v=0.9451485087333713")
elif website == 13:
img = get("https://uploadbeta.com/api/pictures/random/?key=%E6%80%A7%E6%84%9F")
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 #成功了就赶紧结束啦!
filename = str(random.random()) + ".png"
try:
if website == 0:
img = get("https://mm.52.mk/img")
elif website == 1:
img = get("https://api.helloworld.la/xiezhen_xinggan.php")
elif website == 2:
img = get("https://api.66mz8.com/api/rand.tbimg.php")
elif website == 3:
img = get("https://api.isoyu.com/mm_images.php")
elif website == 4:
img = get("https://uploadbeta.com/api/pictures/random/?key=%E5%A5%B3")
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=%E7%BE%8E%E5%A5%B3")
elif website == 8:
img = get("https://api.diskgirl.com/image/api.php?t=xinggan&v=" + str(random.uniform(0, 100)))
elif website == 9:
img = get("https://api.lyiqk.cn/sexylady")
elif website == 10:
img = get("https://api.pingping6.com/tools/acg3/index.php")
elif website == 11:
img = get("https://api.uomg.com/api/rand.img3")
elif website == 12:
img = get("https://api.diskgirl.com/image/api.php?t=&v=0.9451485087333713")
elif website == 13:
img = get("https://uploadbeta.com/api/pictures/random/?key=%E6%80%A7%E6%84%9F")
if img.status_code == 200:
with open(filename, 'wb') as f:
await context.edit("上传中 . . .")
f.write(img.content)
await context.client.send_file(
context.chat_id,
filename,
reply_to=None,
caption=None
)
try:
remove(filename)
except:
pass
status = True
break #成功了就赶紧结束啦!
except:
continue
if not status:
await context.edit("出错了呜呜呜 ~ 试了好多好多次都无法访问到 API 服务器(没有妹子看啦!) 。")
sleep(2)
@ -69,18 +72,19 @@ async def sp(context):
status = False
for _ in range (20): #最多重试20次
vid = get("https://mv.52.mk/video.php")
filename = str(random.random()) + ".mp4"
if vid.status_code == 200:
with open(r'vid.mp4', 'wb') as f:
await context.edit("正在上传视频")
with open(filename, 'wb') as f:
await context.edit("上传中 . . .")
f.write(vid.content)
await context.client.send_file(
context.chat_id,
"vid.mp4",
filename,
reply_to=None,
caption=None
)
try:
remove('vid.mp4')
remove(filename)
except:
pass
status = True