🐛 Fixed percentage number

This commit is contained in:
zhbaor 2022-10-13 17:35:47 +08:00
parent 1d0797a58a
commit 7cef2f75f9
10 changed files with 19 additions and 6 deletions

Binary file not shown.

View file

@ -31,7 +31,10 @@ with db_session:
if i["props"]:
def replace_props(m):
result = i["props"][m.group(1)]
prop_name = m.group(1)
result = i["props"][prop_name]
if prop_name.startswith("prct"):
result = int(result * 100)
if isinstance(result, list):
result = result[0]
if not isinstance(result, str):

View file

@ -35,6 +35,8 @@ with db_session:
if prop_name == "ShockAffectDuration":
prop_name = "duration" # 雷盾带电手动触发
result = i["props"][prop_name]
if prop_name.startswith("prct"):
result = int(result * 100)
if isinstance(result, list):
result = result[0]
if not isinstance(result, str):

View file

@ -35,6 +35,8 @@ with db_session:
if prop_name == "ShockAffectDuration":
prop_name = "duration2" # 雷盾带电手动触发
result = i["props"][prop_name]
if prop_name.startswith("prct"):
result = int(result * 100)
if isinstance(result, list):
result = result[0]
if not isinstance(result, str):

View file

@ -19,10 +19,16 @@ class OutfitSpider(scrapy.Spider):
def parse(self, response):
for quote in response.css(".wikitable tbody tr"):
name_en = quote.css("td:nth-child(2) > span:last-child::text").get()
preview = quote.css("td:nth-child(6) a::attr('href')").get()
if not name_en:
print(name_en)
continue
r = requests.get(preview)
with db_session:
w = Outfit.select(name_en=name_en).first()
w.preview = io.BytesIO(r.content).getbuffer().tobytes()
preview = quote.css(
"td:nth-child(6) > span:last-child a::attr('href')"
).get()
try:
r = requests.get(preview)
with db_session:
w = Outfit.select(name_en=name_en).first()
w.preview = io.BytesIO(r.content).getbuffer().tobytes()
except:
print("Preview not available.")

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 60 KiB