mirror of
https://github.com/PaiGramTeam/PamGram.git
synced 2024-11-16 03:55:26 +00:00
🐛 Fix post parse image extension in jpeg
This commit is contained in:
parent
ec6361fc09
commit
4b139b5169
@ -97,8 +97,9 @@ class HyperionBase:
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
async def download_image(client: "HyperionRequest", art_id: int, url: str, page: int = 0) -> List[ArtworkImage]:
|
async def download_image(client: "HyperionRequest", art_id: int, url: str, page: int = 0) -> List[ArtworkImage]:
|
||||||
filename = os.path.basename(url)
|
filename = os.path.basename(url)
|
||||||
_, file_extension = os.path.splitext(filename)
|
_, _file_extension = os.path.splitext(filename)
|
||||||
is_image = bool(file_extension in ".jpg" or file_extension in ".png")
|
file_extension = _file_extension.lower()
|
||||||
|
is_image = file_extension in ".jpg" or file_extension in ".jpeg" or file_extension in ".png"
|
||||||
response = await client.get(
|
response = await client.get(
|
||||||
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
|
||||||
)
|
)
|
||||||
|
@ -107,7 +107,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 = [image["url"] for image in image_list]
|
image_urls = list({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