mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-10 19:46:36 +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,
|
||||
UpdateEditMessage, UpdateEditChannelMessage, UpdateShort, Updates,
|
||||
MessageMediaWebPage, ChannelParticipantsSearch, PhotoSize, PhotoCachedSize,
|
||||
PhotoSizeEmpty, MessageService, ChatParticipants, User,
|
||||
PhotoSizeEmpty, MessageService, ChatParticipants, User, WebPage,
|
||||
ChannelParticipantsBanned, ChannelParticipantsKicked
|
||||
)
|
||||
from .tl.types.messages import DialogsSlice
|
||||
|
@ -1905,6 +1905,10 @@ class TelegramClient(TelegramBareClient):
|
|||
date = datetime.now()
|
||||
media = message
|
||||
|
||||
if isinstance(media, MessageMediaWebPage):
|
||||
if isinstance(media.webpage, WebPage):
|
||||
media = media.webpage.document or media.webpage.photo
|
||||
|
||||
if isinstance(media, (MessageMediaPhoto, Photo,
|
||||
PhotoSize, PhotoCachedSize)):
|
||||
return self._download_photo(
|
||||
|
|
Loading…
Reference in New Issue
Block a user