skip to Main Content

Im trying send_media_group photo by url. In documentation says that i can use HTTP links, but gives an error message:

pyrogram.errors.exceptions.bad_request_400.MediaInvalid: Telegram says: [400 MEDIA_INVALID] - The media is invalid (caused by "messages.UploadMedia")

When I try to send as file, everything works. Of course, I can first download and then send as a file. But it will slow down the sending speed.

Code:

url = https://photo.jpg
await app.send_media_group(
        msg.chat.id, 
            [
                InputMediaPhoto(url)
            ]
        )

2

Answers


  1. The image at the link given may be too large. Telegram doesn’t fetch media larger than 10 MB and you’ll have to download then upload yourself.

    Login or Signup to reply.
  2. I have Used your code and Uploaded a Image from the URL,
    It would be Better if you Provide the url of Image your trying to Upload

    from pyrogram.types import InputMediaPhoto
    url = 'https://www.google.com/logos/doodles/2022/honoring-anne-frank-6753651837109814.2-lawcta.gif'
    await bot.send_media_group(
            message.chat.id, 
                [
                    InputMediaPhoto(url)
                ]
            )
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search