This commit is contained in:
liyp 2021-09-22 18:07:08 +08:00
parent 2da71764f7
commit e25640c858
3 changed files with 53 additions and 39 deletions

View file

@ -19,7 +19,11 @@ class Ans(StdAns):
if count < 5: if count < 5:
# soft = list() # soft = list()
for i in range(count): for i in range(count):
<<<<<<< HEAD
soft+= req['results'][i]['Name']+'\n'
=======
soft= req['results'][i]['Name'] soft= req['results'][i]['Name']
>>>>>>> 474bbe65ba3f5429e9f23173e163d70f62832566
else: else:
for i in range(5): for i in range(5):
soft+=req['results'][i]['Name']+'\n' soft+=req['results'][i]['Name']+'\n'

View file

@ -21,7 +21,7 @@ class Ans(StdAns):
msg = '/pixiv 获取昨日随机日榜\n/pixiv [关键词] 使用关键词搜索,不可以有空格哦\n/pixiv id [插画id] 获取指定插画,不可以是漫画(\n/pixiv help 展示本 help' msg = '/pixiv 获取昨日随机日榜\n/pixiv [关键词] 使用关键词搜索,不可以有空格哦\n/pixiv id [插画id] 获取指定插画,不可以是漫画(\n/pixiv help 展示本 help'
return msg return msg
elif self.parms[1] == 'id' : elif self.parms[1] == 'id':
try: try:
id = int(self.parms[2]) id = int(self.parms[2])
illust = getbyid(id) illust = getbyid(id)
@ -36,71 +36,77 @@ class Ans(StdAns):
if illust == {}: if illust == {}:
msg = '[CQ:reply,id={}] 看起来什么东西出错了 >_<\n稍后再试试吧'.format(str(self.raw_msg['message_id'])) msg = '[CQ:reply,id={}] 看起来什么东西出错了 >_<\n稍后再试试吧'.format(str(self.raw_msg['message_id']))
else : else:
imgid = str(illust['id']) imgid = str(illust['id'])
imgtitle = illust['title'] imgtitle = illust['title']
imgo = illust['imageUrls'][0]['original'].replace('https://i.pximg.net','https://i.pixiv.cat') imgo = illust['image_urls']['original'].replace('https://i.pximg.net', 'https://i.pixiv.cat')
imgl = illust['imageUrls'][0]['large'].replace('https://i.pximg.net','https://i.pixiv.cat') imgl = illust['image_urls']['large'].replace('https://i.pximg.net', 'https://i.pixiv.cat')
if self.parms[len(self.parms)-1] == 'o': if self.parms[len(self.parms) - 1] == 'o':
imgl = imgo imgl = imgo
msg = '[CQ:reply,id={}]咱帮你🔍找到了这个[CQ:image,file={}]\nid {}\ntitle {}\nurl {}'.format(str(self.raw_msg['message_id']), imgl, imgid, imgtitle, imgo) msg = '[CQ:reply,id={}]咱帮你🔍找到了这个[CQ:image,file={}]\nid {}\ntitle {}\nurl {}'.format(
str(self.raw_msg['message_id']), imgl, imgid, imgtitle, imgo)
# .replace('https://i.pixiv.cat', 'https://pximg.sihuan.workers.dev') # .replace('https://i.pixiv.cat', 'https://pximg.sihuan.workers.dev')
# msg = picurl.replace('https://i.pixiv.cat', 'https://original.img.cheerfun.dev' # msg = picurl.replace('https://i.pixiv.cat', 'https://original.img.cheerfun.dev'
return msg return msg
def rsearch(s):
r = random.randint(0, 233) def rsearch():
r = random.randint(0, 30)
if s == '': # if s == '':
url = 'https://api.pixivic.com/ranks' url = 'https://api.obfs.dev/api/pixiv/rank'
yesterday = datetime.today() + timedelta(-1) yesterday = datetime.today() + timedelta(-1)
print(yesterday.strftime('%Y-%m-%d'))
params = { params = {
'date' : yesterday.strftime('%Y-%m-%d') , 'date': yesterday.strftime('%Y-%m-%d'),
'mode' : 'day', 'mode': 'day',
'pageSize' : 1, 'page': r,
'page' : r, 'size': 5
} }
# else:
else: # url = 'https://api.obfs.dev/api/pixiv/illust'
url = 'https://api.pixivic.com/illustrations' # params = {
params = { # 'id': s,
'keyword': s, # 'illustType': 'illust',
'illustType': 'illust', # 'searchType': 'autoTranslate',
'searchType': 'autoTranslate', # 'pageSize': 1,
'pageSize': 1, # 'page': r,
'page': r # 'token': ''
} # }
for _ in range(3): for _ in range(3):
print(r) print(r)
resp = requests.get(url=url, params=params).json() resp = requests.get(url=url, params=params).json()
if 'data' in resp : # if 'data' in resp:
if resp['data'][0]['type'] != 'illust': # if resp['illust']['type'] == 'illust':
params['page'] += 1 # if s == '':
continue # params['page'] += 1
# continue
return resp['data'][0] resp['illusts'][0]['image_urls'] = [{
params['page'] = int(params['page']/2) 'large': resp['illusts'][0]['image_urls']['large'],
'original': resp['illusts'][0]['meta_single_page']['original_image_url']
}]
# return resp['data']
return resp['illusts']
# return resp['data'][0]
# params['page'] = int(params['page'] / 2)
return {} return {}
def getbyid(id): def getbyid(id):
url = 'https://api.obfs.dev/api/pixiv/illust'
url = 'https://api.imjad.cn/pixiv/v2/'
params = { params = {
'type': 'illust', # 'type': 'illust',
'id': id, 'id': id,
} }
resp = requests.get(url=url, params=params).json() resp = requests.get(url=url, params=params).json()
if 'illust' in resp and resp['illust']['type'] == 'illust': if 'illust' in resp and resp['illust']['type'] == 'illust':
resp['illust']['imageUrls'] = [{ resp['illust']['image_urls'] = [{
'large': resp['illust']['image_urls']['large'], 'large': resp['illust']['image_urls']['large'],
'original': resp['illust']['meta_single_page']['original_image_url'] 'original': resp['illust']['meta_single_page']['original_image_url']
}] }]

View file

@ -15,6 +15,10 @@ class Ans(StdAns):
'Community, Community-Testing仓库以及AUR的软件 ' 'Community, Community-Testing仓库以及AUR的软件 '
return msg return msg
else: else:
<<<<<<< HEAD
self.parms[1]=self.parms[1].lower()
=======
>>>>>>> 474bbe65ba3f5429e9f23173e163d70f62832566
repo = str() repo = str()
try: try:
if len(self.parms) > 1: if len(self.parms) > 1: