snobu / destreamer

Save Microsoft Stream videos for offline enjoyment.
MIT License
2.37k stars 439 forks source link

Got this three times in a row for a 3hr video #122

Closed chiragdkothari closed 4 years ago

chiragdkothari commented 4 years ago

got this message 3 times when downloading a 3hr video also got this for another video ~2.75hrs long.. videos <1.5 hrs are not showing problem ... this started happening after builing the latest comit ....

Error ``` Error: Request failed with status code 401 at createError (E:\studies\destreamer-master -new\destreamer-master\node_modules\axios\lib\core\createError.js:16:15) at settle (E:\studies\destreamer-master -new\destreamer-master\node_modules\axios\lib\core\settle.js:17:12) at IncomingMessage.handleStreamEnd (E:\studies\destreamer-master -new\destreamer-master\node_modules\axios\lib\adapters\http.js:236:11) at IncomingMessage.emit (events.js:323:22) at endReadableNT (_stream_readable.js:1204:12) at processTicksAndRejections (internal/process/task_queues.js:84:21) { config: { url: 'https://euwe-1.api.microsoftstream.com/api/refreshtoken?api-version=1.4-private', method: 'get', headers: { Accept: 'application/json, text/plain, */*', Cookie: 'Authorization=TOKEN httponly,Signature=l5%252fC3RgS1m2BeI8%252fS0%253d; path=/; SameSite=None; secure; httponly', 'User-Agent': 'axios/0.19.2' }, transformRequest: [ [Function: transformRequest] ], transformResponse: [ [Function: transformResponse] ], timeout: 0, adapter: [Function: httpAdapter], xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, validateStatus: [Function: validateStatus], data: undefined }, request: ClientRequest { _events: [Object: null prototype] { socket: [Function], abort: [Function], aborted: [Function], error: [Function], timeout: [Function], prefinish: [Function: requestOnPrefinish] }, _eventsCount: 6, _maxListeners: undefined, outputData: [], outputSize: 0, writable: true, _last: true, chunkedEncoding: false, shouldKeepAlive: false, useChunkedEncodingByDefault: false, sendDate: false, _removedConnection: false, _removedContLen: false, _removedTE: false, _contentLength: 0, _hasBody: true, _trailer: '', finished: true, _headerSent: true, socket: TLSSocket { _tlsOptions: [Object], _secureEstablished: true, _securePending: false, _newSessionPending: false, _controlReleased: true, _SNICallback: null, servername: 'euwe-1.api.microsoftstream.com', alpnProtocol: false, authorized: true, authorizationError: null, encrypted: true, _events: [Object: null prototype], _eventsCount: 9, connecting: false, _hadError: false, _parent: null, _host: 'euwe-1.api.microsoftstream.com', _readableState: [ReadableState], readable: true, _maxListeners: undefined, _writableState: [WritableState], writable: false, allowHalfOpen: false, _sockname: null, _pendingData: null, _pendingEncoding: '', server: undefined, _server: null, ssl: [TLSWrap], _requestCert: true, _rejectUnauthorized: true, parser: null, _httpMessage: [Circular], [Symbol(res)]: [TLSWrap], [Symbol(asyncId)]: 48932, [Symbol(kHandle)]: [TLSWrap], [Symbol(lastWriteQueueSize)]: 0, [Symbol(timeout)]: null, [Symbol(kBuffer)]: null, [Symbol(kBufferCb)]: null, [Symbol(kBufferGen)]: null, [Symbol(kCapture)]: false, [Symbol(kBytesRead)]: 0, [Symbol(kBytesWritten)]: 0, [Symbol(connect-options)]: [Object] }, connection: TLSSocket { _tlsOptions: [Object], _secureEstablished: true, _securePending: false, _newSessionPending: false, _controlReleased: true, _SNICallback: null, servername: 'euwe-1.api.microsoftstream.com', alpnProtocol: false, authorized: true, authorizationError: null, encrypted: true, _events: [Object: null prototype], _eventsCount: 9, connecting: false, _hadError: false, _parent: null, _host: 'euwe-1.api.microsoftstream.com', _readableState: [ReadableState], readable: true, _maxListeners: undefined, _writableState: [WritableState], writable: false, allowHalfOpen: false, _sockname: null, _pendingData: null, _pendingEncoding: '', server: undefined, _server: null, ssl: [TLSWrap], _requestCert: true, _rejectUnauthorized: true, parser: null, _httpMessage: [Circular], [Symbol(res)]: [TLSWrap], [Symbol(asyncId)]: 48932, [Symbol(kHandle)]: [TLSWrap], [Symbol(lastWriteQueueSize)]: 0, [Symbol(timeout)]: null, [Symbol(kBuffer)]: null, [Symbol(kBufferCb)]: null, [Symbol(kBufferGen)]: null, [Symbol(kCapture)]: false, [Symbol(kBytesRead)]: 0, [Symbol(kBytesWritten)]: 0, [Symbol(connect-options)]: [Object] }, _header: 'GET /api/refreshtoken?api-version=1.4-private HTTP/1.1\r\n' + 'Accept: application/json, text/plain, */*\r\n' + 'Cookie: Authorization=TOKEN httponly,Signature=l5%252fHRpp7j5vunpeI8%252fS0%253d; path=/; SameSite=None; secure; httponly\r\n' + 'User-Agent: axios/0.19.2\r\n' + 'Host: euwe-1.api.microsoftstream.com\r\n' + 'Connection: close\r\n' + '\r\n', _onPendingData: [Function: noopPendingOutput], agent: Agent { _events: [Object: null prototype], _eventsCount: 2, _maxListeners: undefined, defaultPort: 443, protocol: 'https:', options: [Object], requests: {}, sockets: [Object], freeSockets: {}, keepAliveMsecs: 1000, keepAlive: false, maxSockets: Infinity, maxFreeSockets: 256, maxCachedSessions: 100, _sessionCache: [Object], [Symbol(kCapture)]: false }, socketPath: undefined, method: 'GET', insecureHTTPParser: undefined, path: '/api/refreshtoken?api-version=1.4-private', _ended: true, res: IncomingMessage { _readableState: [ReadableState], readable: false, _events: [Object: null prototype], _eventsCount: 3, _maxListeners: undefined, socket: [TLSSocket], connection: [TLSSocket], httpVersionMajor: 1, httpVersionMinor: 1, httpVersion: '1.1', complete: true, headers: [Object], rawHeaders: [Array], trailers: {}, rawTrailers: [], aborted: false, upgrade: false, url: '', method: null, statusCode: 401, statusMessage: 'Unauthorized', client: [TLSSocket], _consuming: false, _dumped: false, req: [Circular], responseUrl: 'https://euwe-1.api.microsoftstream.com/api/refreshtoken?api-version=1.4-private', redirects: [], [Symbol(kCapture)]: false }, aborted: false, timeoutCb: null, upgradeOrConnect: false, parser: null, maxHeadersCount: null, reusedSocket: false, _redirectable: Writable { _writableState: [WritableState], writable: true, _events: [Object: null prototype], _eventsCount: 2, _maxListeners: undefined, _options: [Object], _redirectCount: 0, _redirects: [], _requestBodyLength: 0, _requestBodyBuffers: [], _onNativeResponse: [Function], _currentRequest: [Circular], _currentUrl: 'https://euwe-1.api.microsoftstream.com/api/refreshtoken?api-version=1.4-private', [Symbol(kCapture)]: false }, [Symbol(kCapture)]: false, [Symbol(kNeedDrain)]: false, [Symbol(corked)]: 0, [Symbol(kOutHeaders)]: [Object: null prototype] { accept: [Array], cookie: [Array], 'user-agent': [Array], host: [Array] } }, response: { status: 401, statusText: 'Unauthorized', headers: { 'cache-control': 'no-cache', pragma: 'no-cache', expires: '-1', 'x-ms-request-id': '2d62ce1d-6c28-4ebe-8e5d-08c84a2d2b07', 'access-control-expose-headers': 'x-ms-request-id', 'www-authenticate': 'Bearer', 'strict-transport-security': 'max-age=31536000; includeSubDomains', date: 'Wed, 06 May 2020 16:01:18 GMT', connection: 'close', 'content-length': '0' }, config: { url: 'https://euwe-1.api.microsoftstream.com/api/refreshtoken?api-version=1.4-private', method: 'get', headers: [Object], transformRequest: [Array], transformResponse: [Array], timeout: 0, adapter: [Function: httpAdapter], xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, validateStatus: [Function: validateStatus], data: undefined }, request: ClientRequest { _events: [Object: null prototype], _eventsCount: 6, _maxListeners: undefined, outputData: [], outputSize: 0, writable: true, _last: true, chunkedEncoding: false, shouldKeepAlive: false, useChunkedEncodingByDefault: false, sendDate: false, _removedConnection: false, _removedContLen: false, _removedTE: false, _contentLength: 0, _hasBody: true, _trailer: '', finished: true, _headerSent: true, socket: [TLSSocket], connection: [TLSSocket], _header: 'GET /api/refreshtoken?api-version=1.4-private HTTP/1.1\r\n' + 'Accept: application/json, text/plain, */*\r\n' + 'Cookie: Authorization=TOKEN httponly,Signature=l5%252fHRp252fS0%253d; path=/; SameSite=None; secure; httponly\r\n' + 'User-Agent: axios/0.19.2\r\n' + 'Host: euwe-1.api.microsoftstream.com\r\n' + 'Connection: close\r\n' + '\r\n', _onPendingData: [Function: noopPendingOutput], agent: [Agent], socketPath: undefined, method: 'GET', insecureHTTPParser: undefined, path: '/api/refreshtoken?api-version=1.4-private', _ended: true, res: [IncomingMessage], aborted: false, timeoutCb: null, upgradeOrConnect: false, parser: null, maxHeadersCount: null, reusedSocket: false, _redirectable: [Writable], [Symbol(kCapture)]: false, [Symbol(kNeedDrain)]: false, [Symbol(corked)]: 0, [Symbol(kOutHeaders)]: [Object: null prototype] }, data: '' }, isAxiosError: true, toJSON: [Function] } Unhandled error! Timeout or fatal error, please check your downloads directory and try again

i edited the token signatures for privacy ... thanks @lukaarma

lukaarma commented 4 years ago

@chiragdkothari take care to remove personal info (such as the acces token) when pasting errors in Github

This error is generated from Destreamer failing to refresh the login token, I think @snobu has more info about it

snobu commented 4 years ago

Yes, i have a fix for that, /refreshtoken wants the raw cookie and we're sending a stripped down cookie (because ffmpeg is terrible at using large headers) . Will close this as soon as i merge that change in.

chiragdkothari commented 4 years ago

will i be able to do them now with the new code?

chiragdkothari commented 4 years ago

able to download .. .thanks ... also i have modified the current one for polimi .... should i fork it? the already forked one is not updated for a month now....

snobu commented 4 years ago

Try to merge it, since most of the Polimi changes only affect one file, destreamer.ts.

chiragdkothari commented 4 years ago

i am not sure how to do that .. i am very new to github .... also i think we can close this issue, can we?

chiragdkothari commented 4 years ago

Does it make a difference if we use cmd or powershell?

snobu commented 4 years ago

Yes, PowerShell has command history (up arrow) and navigation via CTRL+R, and cmd.exe has

chiragdkothari commented 4 years ago

So which is the best out of the three? is it Powershell?

snobu commented 4 years ago

No such thing as best shell or programming language or anything really. If it works for you and doesn't get in your way, that's the best one.