Merge pull request #2 from xtaodada/master

🚩 acg cosplay meizi - 优化图源与API (#14)
This commit is contained in:
AAA 2020-08-24 15:34:54 +08:00 committed by GitHub
commit fe7c45c1ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 49 additions and 14 deletions

View File

@ -1,3 +1,4 @@
import json
from random import randint from random import randint
from time import sleep from time import sleep
from requests import get from requests import get
@ -11,7 +12,7 @@ async def joke(context):
await context.edit("获取中 . . .") await context.edit("获取中 . . .")
status = False status = False
for _ in range (20): #最多重试20次 for _ in range (20): #最多重试20次
website = randint(0, 3) website = randint(0, 9)
if website == 0: if website == 0:
img = get("http://api.btstu.cn/sjbz/?lx=m_dongman") img = get("http://api.btstu.cn/sjbz/?lx=m_dongman")
elif website == 1: elif website == 1:
@ -20,7 +21,25 @@ async def joke(context):
img = get("https://img.xjh.me/random_img.php?type=bg&ctype=acg&return=302&device=mobile") img = get("https://img.xjh.me/random_img.php?type=bg&ctype=acg&return=302&device=mobile")
elif website == 3: elif website == 3:
img = get("https://www.yunboys.cn/sjbz/api.php?method=mobile&lx=dongman") img = get("https://www.yunboys.cn/sjbz/api.php?method=mobile&lx=dongman")
elif website == 4:
img = get("http://www.dmoe.cc/random.php")
elif website == 5:
img = get("https://api.vvhan.com/api/acgimg")
elif website == 6:
img = get("http://api.mtyqx.cn/api/random.php")
elif website == 7:
img = get("http://random.firefliestudio.com/")
elif website == 8:
img = get("https://api.mmcee.cn/acgimg/acgurl.php")
elif website == 9:
img = get('https://api.lolicon.app/setu/?r18=0')
if img.status_code == 200: if img.status_code == 200:
if website == 9:
tmp = json.loads(img.content)
img = tmp['data'][0]['url']
img = get(img)
if img.status_code != 200:
continue #如果返回不正常就赶紧下一回
with open(r'tu.png', 'wb') as f: with open(r'tu.png', 'wb') as f:
await context.edit("正在上传图片") await context.edit("正在上传图片")
f.write(img.content) f.write(img.content)

View File

@ -11,7 +11,7 @@ async def joke(context):
await context.edit("获取中 . . .") await context.edit("获取中 . . .")
status = False status = False
for _ in range (20): #最多重试20次 for _ in range (20): #最多重试20次
website = randint(0, 4) website = randint(0, 6)
if website == 0: if website == 0:
img = get("https://api.helloworld.la/xiezhen_cosplay.php") img = get("https://api.helloworld.la/xiezhen_cosplay.php")
elif website == 1: elif website == 1:
@ -22,6 +22,10 @@ async def joke(context):
img = get("http://api.rosysun.cn/cos") img = get("http://api.rosysun.cn/cos")
elif website == 4: elif website == 4:
img = get("https://uploadbeta.com/api/pictures/random/?key=%E5%8A%A8%E6%BC%AB") 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 img.status_code == 200:
if website == 3: if website == 3:
img = get(img.content) img = get(img.content)

View File

@ -152,7 +152,7 @@
}, },
{ {
"name": "portball", "name": "portball",
"version": "1.21", "version": "1.2",
"section": "chat", "section": "chat",
"maintainer": "Pentacene", "maintainer": "Pentacene",
"size": "3.6 kb", "size": "3.6 kb",
@ -212,30 +212,30 @@
}, },
{ {
"name": "cosplay-multi", "name": "cosplay-multi",
"version": "1.0", "version": "1.1",
"section": "profile", "section": "profile",
"maintainer": "TNTcraftHIM", "maintainer": "TNTcraftHIM",
"size": "1.8 kb", "size": "2.0 kb",
"supported": true, "supported": true,
"des-short": "多网站随机获取Cos图", "des-short": "多网站随机获取Cos图",
"des": "在不同的几个网站中随机获取Cosplay图片解决了cosplay单个API流量用尽后无法获取的问题。命令cosm。" "des": "在不同的几个网站中随机获取Cosplay图片解决了cosplay单个API流量用尽后无法获取的问题。命令cosm。"
}, },
{ {
"name": "meizi", "name": "meizi",
"version": "1.0", "version": "1.1",
"section": "profile", "section": "profile",
"maintainer": "TNTcraftHIM", "maintainer": "TNTcraftHIM",
"size": "2.0 kb", "size": "2.6 kb",
"supported": true, "supported": true,
"des-short": "多网站随机获取写真", "des-short": "多网站随机获取写真",
"des": "从不同的网站中调取妹子写真但是无漏点放心使用安全版ghs。命令meizi。" "des": "从不同的网站中调取妹子写真但是无漏点放心使用安全版ghs。命令meizi。"
}, },
{ {
"name": "acg-multi", "name": "acg-multi",
"version": "1.0", "version": "1.1",
"section": "profile", "section": "profile",
"maintainer": "TNTcraftHIM", "maintainer": "TNTcraftHIM",
"size": "1.4 kb", "size": "2.4 kb",
"supported": true, "supported": true,
"des-short": "多网站随机获取ACG图", "des-short": "多网站随机获取ACG图",
"des": "从几个不同的图库中随机获取二刺螈bushiACG图片基本都是手机尺寸的图。命令acgm。" "des": "从几个不同的图库中随机获取二刺螈bushiACG图片基本都是手机尺寸的图。命令acgm。"

View File

@ -7,19 +7,19 @@ from os import remove
@listener(is_plugin=True, outgoing=True, command="meizi", @listener(is_plugin=True, outgoing=True, command="meizi",
description="多网站随机获取性感(可能)的写真") description="多网站随机获取性感(可能)的写真")
async def joke(context): async def meizi(context):
await context.edit("获取中 . . .") await context.edit("获取中 . . .")
status = False status = False
for _ in range (20): #最多重试20次 for _ in range (20): #最多重试20次
website = randint(0, 7) website = randint(0, 13)
if website == 0: if website == 0:
img = get("https://mm.52.mk") img = get("https://mm.52.mk")
elif website == 1: elif website == 1:
img = get("https://api.helloworld.la/xiezhen_xinggan.php") img = get("https://api.helloworld.la/xiezhen_xinggan.php")
elif website == 2: elif website == 2:
img = get("https://api.helloworld.la/bizhi_meizi.php") img = get("https://api.qicaiyun.top/sjbz/api.php?lx=meizi")
elif website == 3: elif website == 3:
img = get("https://uploadbeta.com/api/pictures/random/?key=%E5%A4%A7%E5%B0%BA%E5%BA%A6") img = get("http://api.btstu.cn/sjbz/?lx=meizi")
elif website == 4: elif website == 4:
img = get("https://cdn.seovx.com/?mom=302") img = get("https://cdn.seovx.com/?mom=302")
elif website == 5: elif website == 5:
@ -27,7 +27,19 @@ async def joke(context):
elif website == 6: elif website == 6:
img = get("https://uploadbeta.com/api/pictures/random/?key=%E6%8E%A8%E5%A5%B3%E9%83%8E") img = get("https://uploadbeta.com/api/pictures/random/?key=%E6%8E%A8%E5%A5%B3%E9%83%8E")
elif website == 7: elif website == 7:
img = get("https://uploadbeta.com/api/pictures/random/?key=%E5%A5%B3%E7%A5%9E") img = get("https://uploadbeta.com/api/pictures/random/?key=%E7%BE%8E%E5%A5%B3")
elif website == 8:
img = get("https://api.941ka.cn/api/mnxz")
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.pingping6.com/tools/acg3")
elif website == 12:
img = get("https://api.diskgirl.com/image/api.php?t=&v=0.9451485087333713")
elif website == 13:
img = get("https://api.diskgirl.com/image/api.php?t=&v=" + str(random.uniform(0, 100)))
if img.status_code == 200: if img.status_code == 200:
with open(r'tu.png', 'wb') as f: with open(r'tu.png', 'wb') as f:
await context.edit("正在上传图片") await context.edit("正在上传图片")