snobu / destreamer

Save Microsoft Stream videos for offline enjoyment.
MIT License
2.36k stars 442 forks source link

Failed to download some MS Stream videos #379

Closed mexbeb closed 3 years ago

mexbeb commented 3 years ago

Destreamer can't download some videos even though from the MS Stream player I can watch them.

OS: MacOs Catalina 10.15.7

Launch command used: ./destreamer.sh -o /Users/**/Desktop/ -u ** --format mp4 -f links.txt --skip

Verbose log ``` Spawning ffmpeg with access token and HLS URL. This may take a few seconds... [WARNING] Got HTTP code 400. Retrying request... [WARNING] Here is the error message: Buffer(128) [Uint8Array] [ 123, 34, 101, 114, 114, 111, 114, 34, 58, 123, 34, 99, 111, 100, 101, 34, 58, 34, 73, 110, 118, 97, 108, 105, 100, 86, 101, 114, 115, 105, 111, 110, 34, 44, 34, 109, 101, 115, 115, 97, 103, 101, 34, 58, 34, 84, 104, 101, 32, 65, 80, 73, 32, 118, 101, 114, 115, 105, 111, 110, 32, 109, 117, 115, 116, 32, 98, 101, 32, 115, 112, 101, 99, 105, 102, 105, 101, 100, 32, 105, 110, 32, 116, 104, 101, 32, 117, 114, 108, 32, 97, 115, 32, 97, 32, 39, 97, 112, 105, 45, ... 28 more items ] [WARNING] We called this URL: https://euno-1.api.microsoftstream.com/api/null [ERROR] Error: Request failed with status code 400 at createError (/Users/******/destreamer/node_modules/axios/lib/core/createError.js:16:15) at settle (/Users/******/destreamer/node_modules/axios/lib/core/settle.js:17:12) at IncomingMessage.handleStreamEnd (/Users/******/destreamer/node_modules/axios/lib/adapters/http.js:260:11) at IncomingMessage.emit (events.js:327:22) at endReadableNT (internal/streams/readable.js:1327:12) at processTicksAndRejections (internal/process/task_queues.js:80:21) ```
snobu commented 3 years ago

See the top note in the README. Use -x in your command line.

snobu commented 3 years ago

If you want to you can help us track down and close this bug - here's what you need to do: Edit src/VideoUtils.ts and add

console.log(response?.data);

right after this line: https://github.com/snobu/destreamer/blob/master/src/VideoUtils.ts#L94

Run npm run build again.

Then run your download command for the video that fails, (without -x), it should now print a long-ass JSON object to the console.

Locate the section called posterImage, it looks like this:

posterImage: {
    extraSmall: {
      url: 'https://use2-2-content.api.microsoftstream.com/api/thumbnails/22beb...
    },
    ...

Paste here in this issue the entire posterImage section. Please also look for this line (should be right above posterImage -

  state: 'completed',

And let me know what state ... states for you.

Since i can't reproduce the problem i only have a hunch of what's happening. You can help us confirm and fix it.

mexbeb commented 3 years ago

Ok, here is the output:

  privacyMode: 'private',
  published: true,
  state: 'completed',
  encodingProfile: 'passthrough_1Layer_PackagedLocally_NoCopy',
  posterImage: {
    extraSmall: { url: null },
    small: { url: null },
    medium: { url: null },
    large: { url: null }
  },
snobu commented 3 years ago

Thank you. I will add a patch for no thumbnail. Had no idea it could return null. Not that I have the API specs or anything.

Cheers!

snobu commented 3 years ago

Fixed via https://github.com/snobu/destreamer/commit/7d91f32af297ed745e5342ab98eecb17d062720b. git pull and npm run build to apply.

Thank you for your help, @mexbeb!