图片问题:pyrogram.types.inputmediaphoto

发布于 2025-02-10 03:59:41 字数 447 浏览 2 评论 0原文

我尝试了url send_media_group照片。在文档中说我可以使用http链接,但会提供一个错误消息:

pyrogram.errors.exceptions.bad_request_400.mediainvalid:telegram说:[400 Media_invalid] - 媒体无效(由“ Message.uploadMedia”引起,

当我尝试以文件为文件时,一切都可以。当然,我可以首先下载然后作为文件发送。但是它将降低发送速度。

代码:

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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一页 2025-02-17 03:59:41

我已经使用了您的代码,并从URL上传了一个图像,
如果您提供图像的URL,那就更好了

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

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)
            ]
        )
话少心凉 2025-02-17 03:59:41

给定的链接的图像可能太大了。 Telegram不会获取大于10 MB的媒体,您必须下载然后自己上传。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文