node-ytdl-core icon indicating copy to clipboard operation
node-ytdl-core copied to clipboard

Some download formats don't work to download as video

Open Reichmann-M opened this issue 3 years ago • 4 comments

I'm writing a simple youtube downloading tool on an express server and most of the videos I'm testing with are fine.

My script turns out the best video format with ytdl.getInfo and when i'm trying to download this with ytdl.downloadFromInfo and save it to file with fs.createWriteStream i'm getting a 0 bytes file. Other formats work for this video and download is fine.

Example video I used: owic2j9FcMg itags 303 and 299 don't work, which both have the best quality.

Even with the quality option: 'highestvideo' it returns a 0 byte video.

I hope you can help me with that :)

Reichmann-M avatar Apr 14 '21 22:04 Reichmann-M

I couldn't reproduce the issue with itag 303, but I could with itag 299, which appears to silently 404. This may be a bug with the library, but could also be YouTube's mistake.

redbrain avatar Apr 15 '21 00:04 redbrain

I couldn't reproduce the issue with itag 303, but I could with itag 299, which appears to silently 404. This may be a bug with the library, but could also be YouTube's mistake.

yeah same happened to me when i tried to open the urls returned in formats

Reichmann-M avatar Apr 15 '21 11:04 Reichmann-M

Same issue here. In this case(8m75EfIsp_w), ytdl detect 720p (itag:22) version of video but it can't find the file (size missing in information). trying to download this format throws 404 error.

Screenshot from 2021-05-11 19-57-13

samanmohamadi avatar May 11 '21 15:05 samanmohamadi

Same problem here, any updates? :/

My code:

import ytdl from 'ytdl-core'

ytdl('https://www.youtube.com/watch?v=j_BUALoIw4I', { quality: 'highestvideo' })
    .on('end', () => {
        console.log('end')
    })
    .on('error', err => {
        console.log(err)
    })

Result:

MinigetError: Status code: 404
    at ClientRequest.<anonymous> (C:\Users\Kirian\Desktop\ytdl\node_modules\miniget\dist\index.js:210:27)
    at Object.onceWrapper (events.js:422:26)
    at ClientRequest.emit (events.js:315:20)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:641:27)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:126:17)
    at TLSSocket.socketOnData (_http_client.js:509:22)
    at TLSSocket.emit (events.js:315:20)
    at addChunk (internal/streams/readable.js:309:12)
    at readableAddChunk (internal/streams/readable.js:284:9)
    at TLSSocket.Readable.push (internal/streams/readable.js:223:10) {
  statusCode: 404
}

KirianCaumes avatar Jun 12 '21 10:06 KirianCaumes