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