mirror of
https://github.com/KimigaiiWuyi/GenshinUID.git
synced 2025-05-31 12:40:38 +08:00
修复:原神wiki相关功能
This commit is contained in:
parent
56e99ec00c
commit
0a8d936839
34
__init__.py
34
__init__.py
@ -618,18 +618,28 @@ async def weapon_wiki(name):
|
||||
info = data['description']
|
||||
atk = str(data['baseatk'])
|
||||
sub_name = data['substat']
|
||||
sub_val = (data['subvalue'] + '%') if sub_name != '元素精通' else data['subvalue']
|
||||
raw_effect = data['effect']
|
||||
rw_ef = []
|
||||
for i in range(len(data['r1'])):
|
||||
now = ''
|
||||
for j in range(1,6):
|
||||
now = now + data['r{}'.format(j)][i] + "/"
|
||||
now = now[:-1]
|
||||
rw_ef.append(now)
|
||||
raw_effect = raw_effect.format(*rw_ef)
|
||||
effect = data['effectname'] + ":" + raw_effect
|
||||
im = weapon_im.format(name,type,star,info,atk,sub_name,sub_val,effect)
|
||||
if data['subvalue'] != "":
|
||||
sub_val = (data['subvalue'] +
|
||||
'%') if sub_name != '元素精通' else data['subvalue']
|
||||
sub = "\n" + "【" + sub_name + "】" + sub_val
|
||||
else:
|
||||
sub = ""
|
||||
|
||||
if data['effectname'] != "":
|
||||
raw_effect = data['effect']
|
||||
rw_ef = []
|
||||
for i in range(len(data['r1'])):
|
||||
now = ''
|
||||
for j in range(1, 6):
|
||||
now = now + data['r{}'.format(j)][i] + "/"
|
||||
now = now[:-1]
|
||||
rw_ef.append(now)
|
||||
raw_effect = raw_effect.format(*rw_ef)
|
||||
effect = "\n" + "【" + data['effectname'] + "】" + ":" + raw_effect
|
||||
else:
|
||||
effect = ""
|
||||
im = weapon_im.format(name, type, star, info, atk,
|
||||
sub, effect)
|
||||
return im
|
||||
|
||||
async def char_wiki(name,mode = 0,num = 0):
|
||||
|
15
getDB.py
15
getDB.py
@ -4,6 +4,7 @@ import sys
|
||||
from httpx import AsyncClient
|
||||
|
||||
from nonebot import *
|
||||
from bs4 import BeautifulSoup
|
||||
import requests,random,os,json,re
|
||||
import hoshino
|
||||
import asyncio
|
||||
@ -548,11 +549,13 @@ async def GetMysInfo(mysid,ck):
|
||||
async def GetWeaponInfo(name):
|
||||
async with AsyncClient() as client:
|
||||
req = await client.get(
|
||||
url="https://genshin.minigg.cn/?weapon=" + name,
|
||||
url="https://genshin.minigg.cn/?weapons=" + name,
|
||||
headers={
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36',
|
||||
'Referer': 'https://genshin.minigg.cn/index.html'})
|
||||
data = json.loads(req.text)
|
||||
soup = BeautifulSoup(req.text, "lxml")
|
||||
item = soup.select_one("pre").text
|
||||
data = json.loads(item)
|
||||
return data
|
||||
|
||||
async def GetCharInfo(name,mode = 0):
|
||||
@ -563,10 +566,14 @@ async def GetCharInfo(name,mode = 0):
|
||||
str = "&constellations=1"
|
||||
|
||||
async with AsyncClient() as client:
|
||||
|
||||
req = await client.get(
|
||||
url="https://genshin.minigg.cn/?char=" + name + str,
|
||||
url="https://genshin.minigg.cn/?characters=" + name + str,
|
||||
headers={
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36',
|
||||
'Referer': 'https://genshin.minigg.cn/index.html'})
|
||||
data = json.loads(req.text)
|
||||
|
||||
soup = BeautifulSoup(req.text, "lxml")
|
||||
item = soup.select_one("pre").text
|
||||
data = json.loads(item)
|
||||
return data
|
52
getImg.py
52
getImg.py
@ -10,7 +10,7 @@ import numpy as np
|
||||
|
||||
from PIL import Image, ImageDraw, ImageFont, ImageFilter
|
||||
|
||||
from .getDB import GetInfo,GetCharacter,GetSpiralAbyssInfo,GetMysInfo,errorDB,cacheDB
|
||||
from .getDB import GetInfo,GetCharacter,GetSpiralAbyssInfo,GetMysInfo,errorDB,cacheDB,OwnerCookies
|
||||
|
||||
import os
|
||||
import json
|
||||
@ -877,27 +877,39 @@ async def draw_pic(uid,nickname,image = None,mode = 2,role_level = None):
|
||||
|
||||
char_datas = []
|
||||
|
||||
def get_charid(start,end):
|
||||
for i in range(start,end):
|
||||
char_rawdata = GetCharacter(uid,[i],use_cookies)
|
||||
is_owner = await OwnerCookies(uid)
|
||||
if is_owner == None:
|
||||
def get_charid(start,end):
|
||||
for i in range(start,end):
|
||||
char_rawdata = GetCharacter(uid,[i],use_cookies)
|
||||
|
||||
if char_rawdata["retcode"] == -1:
|
||||
pass
|
||||
else:
|
||||
char_datas.append(char_rawdata["data"]['avatars'][0])
|
||||
|
||||
thread_list = []
|
||||
st = 8
|
||||
for i in range(0,8):
|
||||
thread = threading.Thread(target = get_charid,args = (10000002+i*st,10000002+(i+1)*st))
|
||||
thread_list.append(thread)
|
||||
|
||||
for t in thread_list:
|
||||
t.setDaemon(True)
|
||||
t.start()
|
||||
|
||||
if char_rawdata["retcode"] == -1:
|
||||
pass
|
||||
else:
|
||||
char_datas.append(char_rawdata["data"]['avatars'][0])
|
||||
|
||||
thread_list = []
|
||||
st = 8
|
||||
for i in range(0,8):
|
||||
thread = threading.Thread(target = get_charid,args = (10000002+i*st,10000002+(i+1)*st))
|
||||
thread_list.append(thread)
|
||||
|
||||
for t in thread_list:
|
||||
t.setDaemon(True)
|
||||
t.start()
|
||||
for t in thread_list:
|
||||
t.join()
|
||||
|
||||
for t in thread_list:
|
||||
t.join()
|
||||
else:
|
||||
char_ids = []
|
||||
char_rawdata = []
|
||||
|
||||
for i in char_data:
|
||||
char_ids.append(i["id"])
|
||||
|
||||
char_rawdata = GetCharacter(uid,char_ids,use_cookies)
|
||||
char_datas = char_rawdata["data"]["avatars"]
|
||||
|
||||
char_num = len(char_datas)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user