mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-29 00:24:13 +08:00
fix
This commit is contained in:
parent
96e41bd3b5
commit
d01f204afb
@ -121,6 +121,18 @@ def getinfosbyvid(proxy, vid):
|
||||
|
||||
def getcharnamemapbyid(proxy, vid):
|
||||
js = safegetvndbjson(
|
||||
proxy,
|
||||
"character",
|
||||
{
|
||||
"filters": [
|
||||
"vn",
|
||||
"=",
|
||||
["id", "=", vid],
|
||||
],
|
||||
"fields": "name,original",
|
||||
},
|
||||
)
|
||||
js2 = safegetvndbjson(
|
||||
proxy,
|
||||
"vn",
|
||||
{
|
||||
@ -128,18 +140,18 @@ def getcharnamemapbyid(proxy, vid):
|
||||
"fields": "va.character.name,va.character.original",
|
||||
},
|
||||
)
|
||||
print(js)
|
||||
if js:
|
||||
res = js["results"][0]["va"]
|
||||
else:
|
||||
return {}
|
||||
namemap = {}
|
||||
try:
|
||||
for r in res:
|
||||
for r in js2["results"][0]["va"]:
|
||||
r = r["character"]
|
||||
namemap[r["original"]] = r["name"]
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
for r in js["results"]:
|
||||
namemap[r["original"]] = r["name"]
|
||||
except:
|
||||
pass
|
||||
return namemap
|
||||
|
||||
|
||||
@ -352,6 +364,29 @@ class searcher(common):
|
||||
else:
|
||||
return []
|
||||
|
||||
def getcharsfromhtml(self, _vid):
|
||||
|
||||
headers = {
|
||||
"sec-ch-ua": '"Microsoft Edge";v="113", "Chromium";v="113", "Not-A.Brand";v="24"',
|
||||
"Referer": "https://vndb.org/",
|
||||
"sec-ch-ua-mobile": "?0",
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36 Edg/113.0.1774.42",
|
||||
"sec-ch-ua-platform": '"Windows"',
|
||||
}
|
||||
|
||||
html = self.proxysession.get(
|
||||
f"https://vndb.org/{_vid}/chars", headers=headers
|
||||
).text
|
||||
|
||||
find = re.findall(
|
||||
'<tr><td colspan="2"><a href="/c(.*?)>(.*?)</a><small(.*?)>(.*?)</small>',
|
||||
html,
|
||||
)
|
||||
namemap = {}
|
||||
for _, en, _, ja in find:
|
||||
namemap[ja] = en
|
||||
return namemap
|
||||
|
||||
def getreleasecvfromhtml(self, _vid):
|
||||
|
||||
headers = {
|
||||
@ -375,7 +410,9 @@ class searcher(common):
|
||||
infos = getinfosbyvid(self.proxy, vid)
|
||||
|
||||
title = infos["title"]
|
||||
namemap = getcharnamemapbyid(self.proxy, vid)
|
||||
namemap2 = getcharnamemapbyid(self.proxy, vid)
|
||||
namemap = self.getcharsfromhtml(vid)
|
||||
namemap.update(namemap2)
|
||||
vndbtags = self.gettagfromhtml(_vid)
|
||||
developers = infos["dev"]
|
||||
|
||||
|
@ -29,7 +29,7 @@ include(generate_product_version)
|
||||
|
||||
set(VERSION_MAJOR 5)
|
||||
set(VERSION_MINOR 36)
|
||||
set(VERSION_PATCH 1)
|
||||
set(VERSION_PATCH 2)
|
||||
|
||||
add_library(pch pch.cpp)
|
||||
target_precompile_headers(pch PUBLIC pch.h)
|
||||
|
Loading…
x
Reference in New Issue
Block a user