mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-23 01:46:35 +03:00
Handle web pages on .download_media
This commit is contained in:
parent
88597f0da8
commit
75d37a3870
|
@ -84,7 +84,7 @@ from .tl.types import (
|
||||||
InputMessageEntityMentionName, DocumentAttributeVideo,
|
InputMessageEntityMentionName, DocumentAttributeVideo,
|
||||||
UpdateEditMessage, UpdateEditChannelMessage, UpdateShort, Updates,
|
UpdateEditMessage, UpdateEditChannelMessage, UpdateShort, Updates,
|
||||||
MessageMediaWebPage, ChannelParticipantsSearch, PhotoSize, PhotoCachedSize,
|
MessageMediaWebPage, ChannelParticipantsSearch, PhotoSize, PhotoCachedSize,
|
||||||
PhotoSizeEmpty, MessageService, ChatParticipants, User,
|
PhotoSizeEmpty, MessageService, ChatParticipants, User, WebPage,
|
||||||
ChannelParticipantsBanned, ChannelParticipantsKicked
|
ChannelParticipantsBanned, ChannelParticipantsKicked
|
||||||
)
|
)
|
||||||
from .tl.types.messages import DialogsSlice
|
from .tl.types.messages import DialogsSlice
|
||||||
|
@ -1905,6 +1905,10 @@ class TelegramClient(TelegramBareClient):
|
||||||
date = datetime.now()
|
date = datetime.now()
|
||||||
media = message
|
media = message
|
||||||
|
|
||||||
|
if isinstance(media, MessageMediaWebPage):
|
||||||
|
if isinstance(media.webpage, WebPage):
|
||||||
|
media = media.webpage.document or media.webpage.photo
|
||||||
|
|
||||||
if isinstance(media, (MessageMediaPhoto, Photo,
|
if isinstance(media, (MessageMediaPhoto, Photo,
|
||||||
PhotoSize, PhotoCachedSize)):
|
PhotoSize, PhotoCachedSize)):
|
||||||
return self._download_photo(
|
return self._download_photo(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user