fent / node-ytdl-core

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

Cannot download a particular video #769

Open hypo-thesis opened 4 years ago

hypo-thesis commented 4 years ago

Ytdl version : 4.0.3 Node version : 15.0.1

I cannot download this particular video ( no issues with other videos as of now ). It does not throw any error or anything but it get rather stuck.

My const video = ytdl(url, { filter: 'videoonly', quality:highest}) is as :

PassThrough {
  _readableState: ReadableState {
    objectMode: false,
    highWaterMark: 524288,
    buffer: BufferList { head: null, tail: null, length: 0 },
    length: 0,
    pipes: [],
    flowing: null,
    ended: false,
    endEmitted: false,
    reading: false,
    constructed: true,
    sync: false,
    needReadable: false,
    emittedReadable: false,
    readableListening: false,
    resumeScheduled: false,
    errorEmitted: false,
    emitClose: true,
    autoDestroy: true,
    destroyed: false,
    errored: null,
    closed: false,
    closeEmitted: false,
    defaultEncoding: 'utf8',
    awaitDrainWriters: null,
    multiAwaitDrain: false,
    readingMore: false,
    decoder: null,
    encoding: null,
    [Symbol(kPaused)]: null
  },
  _events: [Object: null prototype] {
    prefinish: [Function: prefinish],
    progress: [Function (anonymous)]
  },
  _eventsCount: 2,
  _maxListeners: undefined,
  _writableState: WritableState {
    objectMode: false,
    highWaterMark: 524288,
    finalCalled: false,
    needDrain: false,
    ending: false,
    ended: false,
    finished: false,
    destroyed: false,
    decodeStrings: true,
    defaultEncoding: 'utf8',
    length: 0,
    writing: false,
    corked: 0,
    sync: true,
    bufferProcessing: false,
    onwrite: [Function: bound onwrite],
    writecb: null,
    writelen: 0,
    afterWriteTickInfo: null,
    buffered: [],
    bufferedIndex: 0,
    allBuffers: true,
    allNoop: true,
    pendingcb: 0,
    constructed: true,
    prefinished: false,
    errorEmitted: false,
    emitClose: true,
    autoDestroy: true,
    errored: null,
    closed: false,
    closeEmitted: false,
    [Symbol(kOnFinished)]: []
  },
  allowHalfOpen: true,
  destroy: [Function (anonymous)],
  [Symbol(kCapture)]: false,
  [Symbol(kCallback)]: null
}
bramhaag commented 4 years ago

I encountered the same issue with another video. In my case, it only happened with a specific quality (720p60), all other qualities worked fine.

North-West-Wind commented 4 years ago

What did you mean by stuck? I tried to play this one on my Discord bot and it played for less than a second.

This one also cannot be played before. However, it worked after I promisified ytdl-core with the following code:

const requestYTDLStream = (url, opts) => new Promise((resolve, reject) => {
  const stream = ytdl(url, opts);
  stream.on("finish", () => resolve(stream)).on("error", err => reject(err));
});

Maybe this will help, I don't know.

EDIT: Oh and I should mention that this method didn't work for the first link I posted.

EDIT 2: I also found #770 in open issues. This might be related.

hypo-thesis commented 4 years ago

What did you mean by stuck? I tried to play this one on my Discord bot and it played for less than a second.

This one also cannot be played before. However, it worked after I promisified ytdl-core with the following code:

const requestYTDLStream = (url, opts) => new Promise((resolve, reject) => {
  const stream = ytdl(url, opts);
  stream.on("finish", () => resolve(stream)).on("error", err => reject(err));
});

Maybe this will help, I don't know.

EDIT: Oh and I should mention that this method didn't work for the first link I posted.

EDIT 2: I also found #770 in open issues. This might be related.

Actually none of the qualities can be downloaded. By stuck I mean it does not throw any error it waits until http time out.

Peppy8651 commented 3 years ago

This video works fine with me.

Peppy8651 commented 3 years ago

I tried all these videos on ytdl-core 4.1.6 and they all worked fine for my bot. Btw I'm using repl.it, which might affect the results.

fent commented 3 years ago

it's working for me too. but when the issue first opened, i got an error 🦆