0

While sending documents via external link in telegram bot I am getting error of "Unhandled rejection Error: ETELEGRAM: 400 Bad Request: wrong type of the web page content". I just don't understand why this error occured? P.S I'm using node.js library called node-telegram-bot-api to send requests.

`

bot.sendMediaGroup(
  config.CHANNEL_ID,
  [
    {
      type: "photo",
      media: imgUrl,
      caption: movie,
      parse_mode: "HTML",
    },
    {
      type: "photo",
      media: screenshots[0],
    },
    {
      type: "photo",
      media: screenshots[1],
    },
    {
      type: "video",
      media: videoArray[0].url,
    },
  ],
  {
    disable_notification: true,
  }
);

`

vecume
  • 46
  • 1
  • 4
  • 1
    Describe your question more by showing your code. – Abdulhakim Zeinu Sep 16 '20 at 14:11
  • now you can see a piece of code – vecume Sep 23 '20 at 13:35
  • The code is still not enough to understand your problem. And what do you mean external link? Where is your external link? – Brian B Oct 04 '20 at 12:15
  • Getting same error for this url: https://apod.nasa.gov/apod/image/2101/CoronaConjunction_Masi_1280.jpg In browser its works fine though. But telegram.utils.request.py throwing this for reasons I am not aware of. – omer Jan 19 '21 at 18:02

4 Answers4

0

In my issue i tried to send webp image in my media group. When i deleted, it morking.

0

I had the same issue when sending photos via public URLs.

I tried the same request using InputFile as multipart/form-data, and it worked.

https://core.telegram.org/bots/api#inputfile

Maybe not all URLs have the correct MIME type required by Telegram Bot API.

Ervin Kalemi
  • 569
  • 4
  • 14
0

in my case i built an array with images but set two times the root domain for the image source, like this https://something.com/https://something.com/img/asdf.jpg

Fo Nko
  • 620
  • 10
  • 22
0

Here's what helped in my situation: I added one slash symbol ("/") where the image link contains only one slash symbol ("/").

In my case it worked.

Vlad
  • 11
  • 3