mirror of
https://github.com/TheFunny/TelegramTwitterMediaBot.git
synced 2026-09-23 23:32:05 +00:00
update api format and logger
This commit is contained in:
@@ -32,7 +32,7 @@ class TweetMedia:
|
|||||||
self._type: str = media_type
|
self._type: str = media_type
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"Media[url: {self.url}, thumb: {self.thumb}, type: {self.type}]"
|
return f"Media[url: {self.url} thumb: {self.thumb} type: {self.type}]"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def _uri(self) -> str | None:
|
def _uri(self) -> str | None:
|
||||||
@@ -45,7 +45,7 @@ class TweetMedia:
|
|||||||
def url(self) -> str:
|
def url(self) -> str:
|
||||||
match self._type:
|
match self._type:
|
||||||
case "image":
|
case "image":
|
||||||
return f"{twimg_url}{self._uri}?format=jpg&name=orig"
|
return f"{twimg_url}{self._uri}?format=jpg&name=4096x4096"
|
||||||
case "video":
|
case "video":
|
||||||
return self._url
|
return self._url
|
||||||
|
|
||||||
@@ -171,7 +171,7 @@ class TGTweet(Tweet):
|
|||||||
@property
|
@property
|
||||||
def inline_query_generator(self) -> Generator[InlineQueryResultPhoto | InlineQueryResultVideo, None, None]:
|
def inline_query_generator(self) -> Generator[InlineQueryResultPhoto | InlineQueryResultVideo, None, None]:
|
||||||
for i, tweet_media in enumerate(self.media):
|
for i, tweet_media in enumerate(self.media):
|
||||||
logger.info(f"Media: {str(tweet_media)}")
|
logger.info(str(tweet_media))
|
||||||
if tweet_media.type == "image":
|
if tweet_media.type == "image":
|
||||||
yield InlineQueryResultPhoto(
|
yield InlineQueryResultPhoto(
|
||||||
id=str(i),
|
id=str(i),
|
||||||
@@ -195,7 +195,7 @@ class TGTweet(Tweet):
|
|||||||
@property
|
@property
|
||||||
def pm_media_generator(self) -> Generator[InputMediaPhoto | InputMediaVideo, None, None]:
|
def pm_media_generator(self) -> Generator[InputMediaPhoto | InputMediaVideo, None, None]:
|
||||||
for tweet_media in self.media:
|
for tweet_media in self.media:
|
||||||
logger.info(f"Media: {str(tweet_media)}")
|
logger.info(str(tweet_media))
|
||||||
if tweet_media.type == "image":
|
if tweet_media.type == "image":
|
||||||
yield InputMediaPhoto(
|
yield InputMediaPhoto(
|
||||||
media=tweet_media.url,
|
media=tweet_media.url,
|
||||||
|
|||||||
Reference in New Issue
Block a user