JayJona
JayJona

Reputation: 502

Send large video file by file_id with telegram bot

I'm using python and telebotAPI for my bot and I noticed that the command bot.send_video(chat_id, open(file_name, 'rb')) only sends videos smaller than 10mb, is there a way to send very large video files?

UPDATE: After some comments I read in the telegram documentation: if the file is already stored somewhere on the Telegram servers, you don't need to reupload it: each file object has a file_id field, simply pass this file_id as a parameter instead of uploading. There are no limits for files sent this way. So how I can send a video to the telegram server and then send the file_id to the chat?

Upvotes: 2

Views: 9162

Answers (2)

urmurmur
urmurmur

Reputation: 232

To send using 'file_id' - for example, send file to the bot, the bot will trigger callback, find the remoteFile there, and take id - it will look something like this

AAMCAgADGQEAAqCnXv7lHCkd-2Br08TSugdUR45LVyIAAnoIABJctPlLDk4X8ug8tDcaMSmVLgADAQAHbQADoKoAAhgE

Upvotes: 0

MKia
MKia

Reputation: 46

There is an attribute in send_video function as 'timeout'. By default timeout is 20s. If you need more time for sending your video, set it at your desired time in seconds. For example:

bot.send_video(chat_id='receiver chat id', video=open(file_name, 'rb')), timeout=10000)

Good Luck!

Upvotes: 1

Related Questions