node-twitch-get-stream icon indicating copy to clipboard operation
node-twitch-get-stream copied to clipboard

module not working anymore

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

Since two days this module is not working anymore. Twitch devs probably worked at their API and changed something.

I tried several channels and none of them are working.

This is the error output I get:

Error: Request failed with status code 404
    at createError (C:\Users\xxx\xxx\xxx\xxx\xxx\xxx\node_modules\twitch-get-stream\node_modules\axios\lib\core\createError.js:16:15)
    at settle (C:\Users\xxx\xxx\xxx\xxx\xxx\xxx\node_modules\twitch-get-stream\node_modules\axios\lib\core\settle.js:18:12)
    at IncomingMessage.handleStreamEnd (C:\Users\xxx\xxx\xxx\xxx\xxx\xxx\node_modules\twitch-get-stream\node_modules\axios\lib\adapters\http.js:202: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) {
  config: {
    adapter: [Function: httpAdapter],
    transformRequest: { '0': [Function: transformRequest] },
    transformResponse: { '0': [Function: transformResponse] },
    timeout: 0,
    xsrfCookieName: 'XSRF-TOKEN',
    xsrfHeaderName: 'X-XSRF-TOKEN',
    maxContentLength: -1,
    validateStatus: [Function: validateStatus],
    headers: {
      Accept: 'application/json, text/plain, */*',
      'Client-ID': 'kimne78kx3ncx6brgo4mv6wki5h1ko',
      'User-Agent': 'axios/0.18.1'
    },
    method: 'get',
    url: 'https://api.twitch.tv/api/channels/adorable_kittens/access_token',
    data: undefined
  },
  request: <ref *1> ClientRequest {
    _events: [Object: null prototype] {
      socket: [Function (anonymous)],
      abort: [Function (anonymous)],
      aborted: [Function (anonymous)],
      error: [Function (anonymous)],
      timeout: [Function (anonymous)],
      prefinish: [Function: requestOnPrefinish]
    },
    _eventsCount: 6,
    _maxListeners: undefined,
    outputData: [],
    outputSize: 0,
    writable: true,
    destroyed: false,
    _last: true,
    chunkedEncoding: false,
    shouldKeepAlive: false,
    _defaultKeepAlive: true,
    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,
      secureConnecting: false,
      _SNICallback: null,
      servername: 'api.twitch.tv',
      alpnProtocol: false,
      authorized: true,
      authorizationError: null,
      encrypted: true,
      _events: [Object: null prototype],
      _eventsCount: 10,
      connecting: false,
      _hadError: false,
      _parent: null,
      _host: 'api.twitch.tv',
      _readableState: [ReadableState],
      _maxListeners: undefined,
      _writableState: [WritableState],
      allowHalfOpen: false,
      _sockname: null,
      _pendingData: null,
      _pendingEncoding: '',
      server: undefined,
      _server: null,
      ssl: [TLSWrap],
      _requestCert: true,
      _rejectUnauthorized: true,
      parser: null,
      _httpMessage: [Circular *1],
      [Symbol(res)]: [TLSWrap],
      [Symbol(verified)]: true,
      [Symbol(pendingSession)]: null,
      [Symbol(async_id_symbol)]: 732,
      [Symbol(kHandle)]: [TLSWrap],
      [Symbol(kSetNoDelay)]: false,
      [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],
      [Symbol(RequestTimeout)]: undefined
    },
    _header: 'GET /api/channels/adorable_kittens/access_token HTTP/1.1\r\n' +
      'Accept: application/json, text/plain, */*\r\n' +
      'Client-ID: kimne78kx3ncx6brgo4mv6wki5h1ko\r\n' +
      'User-Agent: axios/0.18.1\r\n' +
      'Host: api.twitch.tv\r\n' +
      'Connection: close\r\n' +
      '\r\n',
    _keepAliveTimeout: 0,
    _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,
      scheduling: 'fifo',
      maxTotalSockets: Infinity,
      totalSocketCount: 1,
      maxCachedSessions: 100,
      _sessionCache: [Object],
      [Symbol(kCapture)]: false
    },
    socketPath: undefined,
    method: 'GET',
    maxHeaderSize: undefined,
    insecureHTTPParser: undefined,
    path: '/api/channels/adorable_kittens/access_token',
    _ended: true,
    res: IncomingMessage {
      _readableState: [ReadableState],
      _events: [Object: null prototype],
      _eventsCount: 3,
      _maxListeners: undefined,
      socket: [TLSSocket],
      httpVersionMajor: 1,
      httpVersionMinor: 1,
      httpVersion: '1.1',
      complete: true,
      headers: [Object],
      rawHeaders: [Array],
      trailers: {},
      rawTrailers: [],
      aborted: false,
      upgrade: false,
      url: '',
      method: null,
      statusCode: 404,
      statusMessage: 'Not Found',
      client: [TLSSocket],
      _consuming: true,
      _dumped: false,
      req: [Circular *1],
      responseUrl: 'https://api.twitch.tv/api/channels/adorable_kittens/access_token',
      redirects: [],
      [Symbol(kCapture)]: false,
      [Symbol(RequestTimeout)]: undefined
    },
    aborted: false,
    timeoutCb: null,
    upgradeOrConnect: false,
    parser: null,
    maxHeadersCount: null,
    reusedSocket: false,
    host: 'api.twitch.tv',
    protocol: 'https:',
    _redirectable: Writable {
      _writableState: [WritableState],
      _events: [Object: null prototype],
      _eventsCount: 2,
      _maxListeners: undefined,
      _options: [Object],
      _redirectCount: 0,
      _redirects: [],
      _requestBodyLength: 0,
      _requestBodyBuffers: [],
      _onNativeResponse: [Function (anonymous)],
      _currentRequest: [Circular *1],
      _currentUrl: 'https://api.twitch.tv/api/channels/adorable_kittens/access_token',
      [Symbol(kCapture)]: false
    },
    [Symbol(kCapture)]: false,
    [Symbol(kNeedDrain)]: false,
    [Symbol(corked)]: 0,
    [Symbol(kOutHeaders)]: [Object: null prototype] {
      accept: [Array],
      'client-id': [Array],
      'user-agent': [Array],
      host: [Array]
    }
  },
  response: {
    status: 404,
    statusText: 'Not Found',
    headers: {
      connection: 'close',
      'content-length': '70',
      'content-type': 'application/json; charset=utf-8',
      'access-control-allow-credentials': 'true',
      'access-control-allow-origin': 'https://www.twitch.tv',
      'cache-control': 'no-cache, no-store, must-revalidate, private',
      expires: '0',
      pragma: 'no-cache',
      'timing-allow-origin': 'https://www.twitch.tv',
      date: 'Mon, 18 Jan 2021 19:19:25 GMT',
      'x-served-by': 'cache-sea4438-SEA, cache-fra19133-FRA',
      'x-cache': 'MISS, MISS',
      'x-cache-hits': '0, 0',
      'x-timer': 'S1610997566.726687,VS0,VS0,VE147',
      vary: 'Accept-Encoding',
      'strict-transport-security': 'max-age=300'
    },
    config: {
      adapter: [Function: httpAdapter],
      transformRequest: [Object],
      transformResponse: [Object],
      timeout: 0,
      xsrfCookieName: 'XSRF-TOKEN',
      xsrfHeaderName: 'X-XSRF-TOKEN',
      maxContentLength: -1,
      validateStatus: [Function: validateStatus],
      headers: [Object],
      method: 'get',
      url: 'https://api.twitch.tv/api/channels/adorable_kittens/access_token',
      data: undefined
    },
    request: <ref *1> ClientRequest {
      _events: [Object: null prototype],
      _eventsCount: 6,
      _maxListeners: undefined,
      outputData: [],
      outputSize: 0,
      writable: true,
      destroyed: false,
      _last: true,
      chunkedEncoding: false,
      shouldKeepAlive: false,
      _defaultKeepAlive: true,
      useChunkedEncodingByDefault: false,
      sendDate: false,
      _removedConnection: false,
      _removedContLen: false,
      _removedTE: false,
      _contentLength: 0,
      _hasBody: true,
      _trailer: '',
      finished: true,
      _headerSent: true,
      socket: [TLSSocket],
      _header: 'GET /api/channels/adorable_kittens/access_token HTTP/1.1\r\n' +
        'Accept: application/json, text/plain, */*\r\n' +
        'Client-ID: kimne78kx3ncx6brgo4mv6wki5h1ko\r\n' +
        'User-Agent: axios/0.18.1\r\n' +
        'Host: api.twitch.tv\r\n' +
        'Connection: close\r\n' +
        '\r\n',
      _keepAliveTimeout: 0,
      _onPendingData: [Function: noopPendingOutput],
      agent: [Agent],
      socketPath: undefined,
      method: 'GET',
      maxHeaderSize: undefined,
      insecureHTTPParser: undefined,
      path: '/api/channels/adorable_kittens/access_token',
      _ended: true,
      res: [IncomingMessage],
      aborted: false,
      timeoutCb: null,
      upgradeOrConnect: false,
      parser: null,
      maxHeadersCount: null,
      reusedSocket: false,
      host: 'api.twitch.tv',
      protocol: 'https:',
      _redirectable: [Writable],
      [Symbol(kCapture)]: false,
      [Symbol(kNeedDrain)]: false,
      [Symbol(corked)]: 0,
      [Symbol(kOutHeaders)]: [Object: null prototype]
    },
    data: {
      error: 'Not Found',
      status: 404,
      message: 'This API does not exist'
    }
  }
}
´´´

Reichmann-M avatar Jan 18 '21 19:01 Reichmann-M

Twitch deprecated tha API endpoint which is used by this library for authentication. I created a pull request #16, but I don't know if this library is still mantained.

acerbisgianluca avatar Jan 19 '21 18:01 acerbisgianluca

https://github.com/dudik/twitch-m3u8 this module got updated and now works again

Reichmann-M avatar Jan 20 '21 11:01 Reichmann-M

@Reichmann-M Oh ok, btw this package returns audio-only url too, so it isn't a problem related to the API if it's missing in that library

acerbisgianluca avatar Jan 20 '21 15:01 acerbisgianluca

is there a way to get the url with web crawler ?

TiagoAndreAlmeida avatar Jan 26 '21 22:01 TiagoAndreAlmeida

@TiagoAndreAlmeida I created a PR (#16) with the fix. You can install the working version from my fork using npm while waiting for them to merge.

acerbisgianluca avatar Jan 27 '21 01:01 acerbisgianluca

i dont think this repo is still maintained. just use this module: dudik/twitch-m3u8

Reichmann-M avatar Jan 27 '21 12:01 Reichmann-M

@acerbisgianluca would you mind in help this repo https://github.com/nikitakatchik/smarttv-twitch i was using this for watch stream on my tv i think is the same problem this repo have.

TiagoAndreAlmeida avatar Jan 27 '21 20:01 TiagoAndreAlmeida

Sadly I don't have time now. If you are familiar with that repo you can copy my code from here

acerbisgianluca avatar Jan 27 '21 22:01 acerbisgianluca