Skip to content

Commit

Permalink
fix: station image cdn
Browse files Browse the repository at this point in the history
  • Loading branch information
omg-xtao committed Nov 14, 2023
1 parent 47a0a1c commit 48b5b75
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
12 changes: 3 additions & 9 deletions res_func/avatar.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,12 @@ async def parse_station(datas, name: str, tag: Tag, cid: int):
def get_third_pic():
_tag = tag.find("div", {"class": "a69d1"})
style = _tag.get("style")
return f'{base_station_url}/{style[style.find("(") + 2:style.find(")")]}'
return f'{style[style.find("(") + 1:style.find(")")]}'

third_pic = get_third_pic()
text = soup.find("div", {"class": "a6678 a4af5"}).get("style")
four_pic = (
f'{base_station_url}{text[text.find("(") + 2:text.find(")") - 1]}'
if text
else ""
)
first_pic = (
f'{base_station_url}{soup.find("img", {"class": "ac39b a6602"}).get("src")}'
)
four_pic = f'{text[text.find("(") + 2:text.find(")") - 1]}' if text else ""
first_pic = f'{soup.find("img", {"class": "ac39b a6602"}).get("src")}'
datas.append(
AvatarIcon(
id=cid,
Expand Down
6 changes: 4 additions & 2 deletions res_func/light_cone.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
async def parse_station(icon: LightConeIcon, tag: Tag):
html = await client.get(f'{base_station_url}{tag.get("href")}')
soup = BeautifulSoup(html.text, "lxml")
first_pic = f'{base_station_url}{soup.find("img", {"class": "standard-icon a6602"}).get("src")}'
second_pic = f'{base_station_url}{soup.find("img", {"class": "a2b16 mobile-only-elem ab8c3"}).get("src")}'
first_pic = f'{soup.find("img", {"class": "standard-icon a6602"}).get("src")}'
second_pic = (
f'{soup.find("img", {"class": "a2b16 mobile-only-elem ab8c3"}).get("src")}'
)
icon.icon = [first_pic, second_pic]
if light_cone_model := all_light_cones_map.get(icon.id):
icon.name = light_cone_model.name
Expand Down

0 comments on commit 48b5b75

Please sign in to comment.