Search code examples
python-3.xtelegrampyrogram

Pyrogram issue: pyrogram.types.InputMediaPhoto


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)
            ]
        )

Solution

  • 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)
                ]
            )