From 0c9d142bca5a26241e3ab8ee63477c82f690b77f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Tue, 27 Aug 2024 14:02:54 +0800 Subject: [PATCH] cvs --- .../LunaTranslator/metadata/vndb.py | 30 ++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/LunaTranslator/LunaTranslator/metadata/vndb.py b/LunaTranslator/LunaTranslator/metadata/vndb.py index b7069d4f..8a1956bd 100644 --- a/LunaTranslator/LunaTranslator/metadata/vndb.py +++ b/LunaTranslator/LunaTranslator/metadata/vndb.py @@ -112,7 +112,8 @@ def getinfosbyvid(proxy, vid): dev.append(item["name"]) return dict( title=gettitlefromjs(js["results"][0]), - imgs=[js["results"][0]["image"]["url"]] + imgs, + img=js["results"][0]["image"]["url"], + sc=imgs, dev=dev, ) @@ -336,6 +337,24 @@ class searcher(common): else: return [] + def getreleasecvfromhtml(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( + self.refmainpage(_vid) + "/cv", headers=headers + ).text + return [ + "https://t.vndb.org/cv/" + _ + for _ in re.findall('"https://t.vndb.org/cv/(.*?)"', html) + ] + def searchfordata(self, _vid): vid = "v{}".format(_vid) infos = getinfosbyvid(self.proxy, vid) @@ -345,12 +364,15 @@ class searcher(common): vndbtags = self.gettagfromhtml(_vid) developers = infos["dev"] - img = [self.dispatchdownloadtask(_) for _ in infos["imgs"]] - + img = [ + self.dispatchdownloadtask(_) + for _ in ([infos["img"]] + self.getreleasecvfromhtml(_vid)) + ] + sc = [self.dispatchdownloadtask(_) for _ in infos["sc"]] return { "namemap": namemap, "title": title, - "imagepath_all": img, + "imagepath_all": img + sc, "webtags": vndbtags, "developers": developers, }