0

This unacceptable error occurs when using ytdl-core and telegraf javascript, all because of these two lines of code:

let video = ytdl('https://www.youtube.com/watch?v=ipAnwilMncI').pipe(fs.createWriteStream(`${ctx.from.id}.webm`));

ctx.replyWithVideo(video)

full text of the error:

C:\Program Files\nodejs\node.exe .\index.js
Uncaught TelegramError Error: 400: Bad Request: invalid file HTTP URL specified: Wrong port number specified in the URL
    at callApi (node_modules\telegraf\lib\core\network\client.js:293:19)
    at processTicksAndRejections (internal/process/task_queues:95:5)
Process exited with code 1

Node.js

I tried to send not as a video but as a document but it did not help

  • 1
    A quick google tells me that `replyWithVideo` seems to want a URL as an argument, not a binary stream. – Evert Feb 06 '23 at 18:57

0 Answers0