ugoira.lib
— Ugoira Download Library¶
Ugoira Download Library
- exception ugoira.lib.PixivError¶
Error with Pixiv
- ugoira.lib.download_ugoira_zip(illust_id: int) tuple[bytes, dict[str, int]] ¶
Download ugoira zip archive.
- Parameters:
illust_id (
int
) – Pixiv illust_id- Returns:
blob of zip file and frame data
- Raises:
PixivError – If fail to access to image file.
- ugoira.lib.get_illust_url(illust_id: int) str ¶
Get illust URL from
illust_id
.- Parameters:
illust_id (
int
) – Pixiv illust_id- Returns:
Pixiv Illust URL
- Return type:
str
- ugoira.lib.get_metadata_url(illust_id: int) str ¶
Get illust Metadata URL from
illust_id
.- Parameters:
illust_id (
int
) – Pixiv illust_id- Returns:
Pixiv Metadata URL
- Return type:
str
- ugoira.lib.make_via_pillow(dest: Path, blob: bytes, frames: dict[str, int], speed: float = 1.0, format: str = 'gif')¶
Make animated file from given file data and frame data.
- Parameters:
dest (
Path
) – path of output fileblob (
bytes
) – blob of zip file fromugoira.lib.download_ugoira_zip()
frames – mapping object of each frame’s filename and interval
speed (
float
) – frame interval control valueformat (
str
) – format of result file
- ugoira.lib.make_zip(dest: Path, blob: bytes, *args)¶
Make ZIP file from given file data.
- Parameters:
dest (
Path
) – path of output fileblob (
bytes
) – blob of zip file fromugoira.lib.download_ugoira_zip()
- ugoira.lib.open_zip_blob(blob: bytes) ZipFile ¶
Make temporary zip file and open it for touch inner files
- Parameters:
blob (
bytes
) – blob of zip file fromugoira.lib.download_ugoira_zip()
- ugoira.lib.pixiv = <httpx.Client object>¶
(
httpx.Client
) httpx Client for keep headers
- ugoira.lib.save(format: str, dest: Path, blob: bytes, frames: dict[str, int], speed: float = 1.0)¶
Save blob to file.
- Parameters:
format (
str
) – file formatdest (
Path
) – path of output fileblob (
bytes
) – blob of zip file fromugoira.lib.download_ugoira_zip()
frames – mapping object of each frame’s filename and interval
speed (
float
) – frame interval control value