mirror of
https://github.com/TeamPGM/PagerMaid_Plugins.git
synced 2024-11-25 10:02:23 +00:00
优化ACGM的API
This commit is contained in:
parent
0e40bf5e83
commit
0c94ecdf43
31
acg-multi.py
31
acg-multi.py
@ -1,7 +1,7 @@
|
||||
import json
|
||||
from random import randint
|
||||
import random
|
||||
import requests
|
||||
from time import sleep
|
||||
from requests import get
|
||||
from pagermaid.listener import listener
|
||||
from os import remove
|
||||
|
||||
@ -12,32 +12,25 @@ async def joke(context):
|
||||
await context.edit("获取中 . . .")
|
||||
status = False
|
||||
for _ in range (20): #最多重试20次
|
||||
website = randint(0, 9)
|
||||
website = random.randint(0, 5)
|
||||
if website == 0:
|
||||
img = get("http://api.btstu.cn/sjbz/?lx=m_dongman")
|
||||
img = requests.get("http://api.btstu.cn/sjbz/?lx=m_dongman")
|
||||
elif website == 1:
|
||||
img = get("https://acg.yanwz.cn/api.php")
|
||||
img = requests.get("https://acg.yanwz.cn/api.php")
|
||||
elif website == 2:
|
||||
img = get("https://img.xjh.me/random_img.php?type=bg&ctype=acg&return=302&device=mobile")
|
||||
img = requests.get("https://img.xjh.me/random_img.php?type=bg&ctype=acg&return=302&device=mobile")
|
||||
elif website == 3:
|
||||
img = get("https://www.yunboys.cn/sjbz/api.php?method=mobile&lx=dongman")
|
||||
img = requests.get("https://www.yunboys.cn/sjbz/api.php?method=mobile&lx=dongman")
|
||||
elif website == 4:
|
||||
img = get("http://www.dmoe.cc/random.php")
|
||||
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 = 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')
|
||||
img = requests.get('https://api.lolicon.app/setu/?r18=0')
|
||||
if img.status_code == 200:
|
||||
if website == 9:
|
||||
if website == 5:
|
||||
tmp = json.loads(img.content)
|
||||
img = tmp['data'][0]['url']
|
||||
img = get(img)
|
||||
img = requests.get(img)
|
||||
if img.status_code != 200:
|
||||
continue #如果返回不正常就赶紧下一回
|
||||
with open(r'tu.png', 'wb') as f:
|
||||
|
Loading…
Reference in New Issue
Block a user