Compare commits

...
4 Commits
3 changed files with 11 additions and 11 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
FROM python:3.13-slim-bullseye FROM python:3.12-slim-bullseye
LABEL maintainer="admin@yoursfunny.top" LABEL maintainer="admin@yoursfunny.top"
+2 -2
View File
@@ -1,4 +1,4 @@
python-telegram-bot[webhooks]~=22.5 python-telegram-bot[webhooks]~=22.8
httpx[http2]~=0.27 httpx[http2]~=0.27
uvloop~=0.22; sys_platform != 'win32' uvloop~=0.22; sys_platform != 'win32'
async-pixiv @ git+https://github.com/TheFunny/async-pixiv@main async-pixiv~=1.1.2
+8 -8
View File
@@ -3,7 +3,7 @@ from __future__ import annotations
from typing import Literal, TYPE_CHECKING from typing import Literal, TYPE_CHECKING
from async_pixiv import PixivClient from async_pixiv import PixivClient
from async_pixiv.error import ApiError from async_pixiv.error import APIError
if TYPE_CHECKING: if TYPE_CHECKING:
from async_pixiv.model.illust import Illust from async_pixiv.model.illust import Illust
@@ -73,27 +73,27 @@ class Pixiv:
@property @property
def is_nsfw(self) -> bool: def is_nsfw(self) -> bool:
return self._illust.is_nsfw return self._illust.sanity_level > 5
@property @property
def is_ai(self) -> bool: def is_ai(self) -> bool:
return self._illust.ai_type.value == 2 return self._illust.ai_type == 2
@property @property
def images(self) -> list[PixivMedia]: def images(self) -> list[PixivMedia]:
if self.is_multiple_pages: if self.is_multiple_pages:
return [ return [
PixivMedia( PixivMedia(
url=page.image_urls.original, url=str(page.image_urls.original),
thumb=page.image_urls.medium thumb=str(page.image_urls.medium)
) )
for page in self._illust.meta_pages for page in self._illust.meta_pages
] ]
else: else:
return [ return [
PixivMedia( # should observe if image_url.original is always None for single page PixivMedia( # should observe if image_url.original is always None for single page
url=self._illust.image_urls.original or self._illust.meta_single_page.original, url=str(self._illust.image_urls.original or self._illust.meta_single_page.original),
thumb=self._illust.image_urls.medium thumb=str(self._illust.image_urls.medium)
) )
] ]
@@ -133,7 +133,7 @@ class ProcessPixiv(_ProcessPixiv):
illust_id = self._parse_illust_id() illust_id = self._parse_illust_id()
try: try:
return (await self._client.ILLUST.detail(illust_id)).illust return (await self._client.ILLUST.detail(illust_id)).illust
except ApiError: except APIError:
await self.refresh_token() await self.refresh_token()
return (await self._client.ILLUST.detail(illust_id)).illust # TODO use retry here return (await self._client.ILLUST.detail(illust_id)).illust # TODO use retry here