fent / node-ytdl-core

YouTube video downloader in javascript.
MIT License
4.54k stars 803 forks source link

Some download formats don't work to download as video #910

Open Reichmann-M opened 3 years ago

Reichmann-M commented 3 years ago

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

redbrain commented 3 years ago

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.

Reichmann-M commented 3 years ago

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

samanmohamadi commented 3 years ago

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

KirianCaumes commented 3 years ago

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
}