mirror of
https://github.com/KimigaiiWuyi/GenshinUID.git
synced 2025-06-03 05:59:51 +08:00
修复:原神wiki相关功能
This commit is contained in:
parent
56e99ec00c
commit
0a8d936839
16
__init__.py
16
__init__.py
@ -618,7 +618,14 @@ async def weapon_wiki(name):
|
|||||||
info = data['description']
|
info = data['description']
|
||||||
atk = str(data['baseatk'])
|
atk = str(data['baseatk'])
|
||||||
sub_name = data['substat']
|
sub_name = data['substat']
|
||||||
sub_val = (data['subvalue'] + '%') if sub_name != '元素精通' else data['subvalue']
|
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']
|
raw_effect = data['effect']
|
||||||
rw_ef = []
|
rw_ef = []
|
||||||
for i in range(len(data['r1'])):
|
for i in range(len(data['r1'])):
|
||||||
@ -628,8 +635,11 @@ async def weapon_wiki(name):
|
|||||||
now = now[:-1]
|
now = now[:-1]
|
||||||
rw_ef.append(now)
|
rw_ef.append(now)
|
||||||
raw_effect = raw_effect.format(*rw_ef)
|
raw_effect = raw_effect.format(*rw_ef)
|
||||||
effect = data['effectname'] + ":" + raw_effect
|
effect = "\n" + "【" + data['effectname'] + "】" + ":" + raw_effect
|
||||||
im = weapon_im.format(name,type,star,info,atk,sub_name,sub_val,effect)
|
else:
|
||||||
|
effect = ""
|
||||||
|
im = weapon_im.format(name, type, star, info, atk,
|
||||||
|
sub, effect)
|
||||||
return im
|
return im
|
||||||
|
|
||||||
async def char_wiki(name,mode = 0,num = 0):
|
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 httpx import AsyncClient
|
||||||
|
|
||||||
from nonebot import *
|
from nonebot import *
|
||||||
|
from bs4 import BeautifulSoup
|
||||||
import requests,random,os,json,re
|
import requests,random,os,json,re
|
||||||
import hoshino
|
import hoshino
|
||||||
import asyncio
|
import asyncio
|
||||||
@ -548,11 +549,13 @@ async def GetMysInfo(mysid,ck):
|
|||||||
async def GetWeaponInfo(name):
|
async def GetWeaponInfo(name):
|
||||||
async with AsyncClient() as client:
|
async with AsyncClient() as client:
|
||||||
req = await client.get(
|
req = await client.get(
|
||||||
url="https://genshin.minigg.cn/?weapon=" + name,
|
url="https://genshin.minigg.cn/?weapons=" + name,
|
||||||
headers={
|
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',
|
'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'})
|
'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
|
return data
|
||||||
|
|
||||||
async def GetCharInfo(name,mode = 0):
|
async def GetCharInfo(name,mode = 0):
|
||||||
@ -563,10 +566,14 @@ async def GetCharInfo(name,mode = 0):
|
|||||||
str = "&constellations=1"
|
str = "&constellations=1"
|
||||||
|
|
||||||
async with AsyncClient() as client:
|
async with AsyncClient() as client:
|
||||||
|
|
||||||
req = await client.get(
|
req = await client.get(
|
||||||
url="https://genshin.minigg.cn/?char=" + name + str,
|
url="https://genshin.minigg.cn/?characters=" + name + str,
|
||||||
headers={
|
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',
|
'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'})
|
'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
|
return data
|
14
getImg.py
14
getImg.py
@ -10,7 +10,7 @@ import numpy as np
|
|||||||
|
|
||||||
from PIL import Image, ImageDraw, ImageFont, ImageFilter
|
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 os
|
||||||
import json
|
import json
|
||||||
@ -877,6 +877,8 @@ async def draw_pic(uid,nickname,image = None,mode = 2,role_level = None):
|
|||||||
|
|
||||||
char_datas = []
|
char_datas = []
|
||||||
|
|
||||||
|
is_owner = await OwnerCookies(uid)
|
||||||
|
if is_owner == None:
|
||||||
def get_charid(start,end):
|
def get_charid(start,end):
|
||||||
for i in range(start,end):
|
for i in range(start,end):
|
||||||
char_rawdata = GetCharacter(uid,[i],use_cookies)
|
char_rawdata = GetCharacter(uid,[i],use_cookies)
|
||||||
@ -899,6 +901,16 @@ async def draw_pic(uid,nickname,image = None,mode = 2,role_level = None):
|
|||||||
for t in thread_list:
|
for t in thread_list:
|
||||||
t.join()
|
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)
|
char_num = len(char_datas)
|
||||||
|
|
||||||
char_hang = 1 + (char_num-1)//6
|
char_hang = 1 + (char_num-1)//6
|
||||||
|
Loading…
x
Reference in New Issue
Block a user