Qustin Malone
Qustin Malone

Reputation: 28

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

Upvotes: 0

Views: 1081

Answers (2)

DeekshithSH
DeekshithSH

Reputation: 172

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

Upvotes: 1

ColinShark
ColinShark

Reputation: 1141

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.

Upvotes: 1

Related Questions