I'm working on telethon download_media
and _download_document
methods for downloading video from telegram. My code is something like this:
def callback(update):
Channel_Entity = client.get_entity(Channel_List) #Get specific Channel information
file_name = str(document_id)+'.mp4'
current_path = os.getcwd()
file_path_gif = current_path+'/media/gif'
file = open(os.path.join(file_path_gif,file_name),'wb')
if isinstance(update, UpdateNewChannelMessage): #Check Update message in channel
if update.message.to_id.channel_id == Channel_Entity.id:
client._download_document(update.message.media, file, update.message.date, progress_callback=None)
# OR
client.download_media(update.message, file, progress_callback=None)
But when a video is sent to channel and downloaded with this code, the video is not playable and the player prints this message: Cannot render the file. This code works on images and gif files but does not work on video files. What should i do?