I am trying to make telegram bot using library python-telegram-bot. One of the features of my bot is to send Instagram’s stories to the user. For this feature I am using method sendMediaGroup
with several InputMediaVideo
or InputMediaPhoto
in the input.
For example (Instagram link is available only for 24 hours, perhaps at the time you read this, it is no longer valid):
def input_media_group_test(update: Update, context: CallbackContext):
update.message.bot.sendMediaGroup(
update.message.chat.id,
[
InputMediaVideo('https://scontent-hel3-1.cdninstagram.com/v/t50.2886-16/88545009_217343653444163_3673202947982720032_n.mp4?efg=eyJ2ZW5jb2RlX3RhZyI6InZ0c192b2RfdXJsZ2VuLjcyMC5zdG9yeS5kZWZhdWx0In0&_nc_ht=scontent-hel3-1.cdninstagram.com&_nc_cat=111&_nc_ohc=2Hc1-g9OjDEAX85a-aD&vs=17858017211381000_2586017057&_nc_vs=HBkcFQAYJEdQRVdSd1ZEX2tGRHJNVUFBQ0I4YmFhZTF2a3lidXFIQUFBQRUAAsgBACgAGAAbAYgHdXNlX29pbAExFQAAJpCr%2B6S08bg%2FFQIoAkMzLBdAFAAAAAAAABgSZGFzaF9iYXNlbGluZV8xX3YxEQB16AcA&_nc_rid=ce28126395&oe=60068925&oh=46f6f85c7e36f37b578c7319a70191bc'),
InputMediaVideo('https://www.learningcontainer.com/wp-content/uploads/2020/05/sample-mp4-file.mp4')
]
)
The code above sends two videos (first from the Instagram) to the user. After I send a command calling this code to my bot I get following error: telegram.error.BadRequest: Wrong file identifier/http url specified
. What am I doing wrong?
If I use the second url instead of the first one everything works fine, the problem arises only when using Instagram's urls for the videos (photos with InputMediaPhoto
works fine).
Also I can send the Instagram video separately, just by calling sendVideo
method with the Instagram's video link in the input, but I am trying to send a batch of videos or photos in this bot.