mirror of
https://github.com/PaiGramTeam/MibooGram.git
synced 2024-11-16 04:45:27 +00:00
🐛 Fix error order in post images
This commit is contained in:
parent
67a2635ea5
commit
83a43c9527
@ -104,7 +104,12 @@ class HyperionBase:
|
||||
url, params=Hyperion.get_images_params(resize=2000) if is_image else None, de_json=False
|
||||
)
|
||||
return ArtworkImage.gen(
|
||||
art_id=art_id, page=page, file_name=filename, file_extension=url.split(".")[-1], data=response.content
|
||||
art_id=art_id,
|
||||
page=page,
|
||||
file_name=filename,
|
||||
file_extension=url.split(".")[-1],
|
||||
data=response.content,
|
||||
url=url,
|
||||
)
|
||||
|
||||
@abstractmethod
|
||||
|
@ -1,3 +1,5 @@
|
||||
from collections import OrderedDict
|
||||
|
||||
import ujson
|
||||
from datetime import datetime, timedelta
|
||||
from enum import Enum
|
||||
@ -26,6 +28,7 @@ class ArtworkImage(BaseModel):
|
||||
file_name: Optional[str] = None
|
||||
file_extension: Optional[str] = None
|
||||
is_error: bool = False
|
||||
url: str = ""
|
||||
|
||||
@property
|
||||
def format(self) -> Optional[str]:
|
||||
@ -107,7 +110,7 @@ class PostInfo(BaseModel):
|
||||
image_keys = {"cover_list", "image_list"}
|
||||
for key in image_keys:
|
||||
image_list.extend(_data_post.get(key, []))
|
||||
image_urls = list({image["url"] for image in image_list})
|
||||
image_urls = list(OrderedDict.fromkeys([image["url"] for image in image_list]))
|
||||
key1, key2 = ("video", "resolution") if hoyolab else ("vod_list", "resolutions")
|
||||
vod_list = _data_post.get(key1, [])
|
||||
if not isinstance(vod_list, list):
|
||||
|
Loading…
Reference in New Issue
Block a user