🐛 fix: new light_cone style

This commit is contained in:
xtaodada 2023-06-06 23:16:03 +08:00
parent 6aaf45985a
commit e2db004ceb
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659
2 changed files with 11 additions and 2 deletions

View File

@ -31,12 +31,16 @@ async def fetch_station() -> List[LightConeIcon]:
print("开始获取光锥素材")
html = await client.get(light_cone_url)
soup = BeautifulSoup(html.text, "lxml")
light_cones = soup.find_all("a", {"class": "a4041 ae026 a5abc"})
light_cones = soup.find_all("a", {"class": "a4041"})
tasks = []
datas: List[LightConeIcon] = []
for light_cone in light_cones:
name = light_cone.find("span").get_text().strip()
url = light_cone.get("href")
if not url:
continue
if "lightcone/" not in url:
continue
nid = int(url.split("/")[-1])
if light_cone_model := all_light_cones_name.get(name):
light_cone_model.id = nid

View File

@ -17,7 +17,12 @@ async def fix_set_image():
divs = soup.find_all("a", {"class": "aff5a"})
data_map: Dict[int, Tuple[str, List[str]]] = {}
for div in divs:
sid = int(div.get("href").split("/")[-1])
url = div.get("href")
if not url:
continue
if "relics/" not in url:
continue
sid = int(url.split("/")[-1])
images = div.find_all("img")
images = [f"{base_station_url}{i.get('src')}" for i in images]
if len(images) not in {3, 5}: