Closed liuyan345 closed 1 year ago
@liuyan345 Look [ckosmic](https://github.com/ckosmic) c comment.
The problem is with Axios 1.2.X use Axios 1.1.3 :) Or add "Accept-Encoding": "gzip" to your headers https://github.com/axios/axios/issues/5346
You're right. It's working. Thanks
The problem is with Axios 1.2.X use Axios 1.1.3 :) Or add "Accept-Encoding": "gzip" to your headers axios/axios#5346
Screenshots
[root@iZj6c54tyfku56hcsa905bZ xxxxxx]# node tiktok-signature/examples/user-videos.js
/data/www/happytokAdmin/tiktok-signature/node_modules/axios/dist/node/axios.cjs:785 AxiosError.call(axiosError, error.message, code, config, request, response); ^ AxiosError: unexpected end of file at Function.AxiosError.from (/data/www/happytokAdmin/tiktok-signature/node_modules/axios/dist/node/axios.cjs:785:14) at BrotliDecompress.handleStreamError (/data/www/happytokAdmin/tiktok-signature/node_modules/axios/dist/node/axios.cjs:2696:29) at BrotliDecompress.emit (node:events:539:35) at emitErrorNT (node:internal/streams/destroy:164:8) at emitErrorCloseNT (node:internal/streams/destroy:129:3) at processTicksAndRejections (node:internal/process/task_queues:83:21) { code: 'Z_BUF_ERROR', errno: -5, config: { transitional: { silentJSONParsing: true, forcedJSONParsing: true, clarifyTimeoutError: false }, adapter: [ 'xhr', 'http' ], transformRequest: [ [Function: transformRequest] ], transformResponse: [ [Function: transformResponse] ], timeout: 0, xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, maxBodyLength: -1, env: { FormData: [Function: FormData] { LINE_BREAK: '\r\n', DEFAULT_CONTENT_TYPE: 'application/octet-stream' }, Blob: null }, validateStatus: [Function: validateStatus], headers: AxiosHeaders { Accept: 'application/json, text/plain, /', 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 Edg/107.0.1418.56', 'x-tt-params': 'mb+z3Pl1d/bc+N0SKnc7nb3QUghzTPiwbDV+3XN8HaTR7ZoEa/7hMEVe8NYseSZKfnOqFJfVa8/noeVN7K2m+ShvQEqpSN4OE3PpwF8WE0lHdpLdjDGIFpLVf87aS2ojRfWVam4Zn+M2shhJTtD0JRaB/gXyNLmuDsnImH+4no9JExlQG8eOwzP6lpaIlm341o3lFUFynA4/b3Bv0vSRhZkWl3nMS3vfy+998pEitjPy2m3uopIhHEx9spxcNmgT71m69c7d5mvCiTpLcE5jDndTRzMsWRd+SMnkGaiF6pePfK2Am1s/FOeQP3CsZQ41kTSXOpO8auQUOj9peSocx1988qZsIdPGDhPFX8jXRiKh+YZLglah7Zk1/TSy7hgB2+uuZMqYwPHv0W18JijziIyZ0GUN/SHdEFerSEpGj3AzNLkvyid7iIWwn19cDynnoHDZ2V8kSmW8Htq+DbvRTyxpxOVE/WGKghws7m2arWgAXgAIPgq6x2UV/T7RVlKWjsRJMWMeJcJn22uby5aI/g==', 'Accept-Encoding': 'gzip, compress, deflate, br' }, method: 'get', url: 'https://www.tiktok.com/api/post/item_list/?aid=1988&app_language=en&app_name=tiktok_web&battery_info=1&browser_language=en-US&browser_name=Mozilla&browser_online=true&browser_platform=Win32&browser_version=5.0%20%28Windows%20NT%2010.0%3B%20Win64%3B%20x64%29%20AppleWebKit%2F537.36%20%28KHTML%2C%20like%20Gecko%29%20Chrome%2F107.0.0.0%20Safari%2F537.36%20Edg%2F107.0.1418.56&channel=tiktok_web&cookie_enabled=true&device_id=7165118680723998214&device_platform=web_pc&focus_state=true&from_page=user&history_len=3&is_fullscreen=false&is_page_visible=true&os=windows&priority_region=RO&referer=®ion=RO&screen_height=1440&screen_width=2560&tz_name=Europe%2FBucharest&webcast_language=en&msToken=G3C-3f8JVeDj9OTvvxfaJ_NppXWzVflwP1dOclpUOmAv4WmejB8kFwndJufXBBrXbeWNqzJgL8iF5zn33da-ZlDihRoWRjh_TDSuAgqSGAu1-4u2YlvCATAM2jl2J1dwNPf0_fk9dx1gJxQ21S0=&X-Bogus=DFSzswVYxTUANS/JS8OTqsXyYJUo&_signature=_02B4Z6wo00001CoOkNwAAIDBCa--cQz5e0wqDpRAAGoE8f', data: undefined }, request: <ref 1> ClientRequest { _events: [Object: null prototype] { abort: [Function (anonymous)], aborted: [Function (anonymous)], connect: [Function (anonymous)], error: [Function (anonymous)], socket: [Function (anonymous)], timeout: [Function (anonymous)], prefinish: [Function: requestOnPrefinish] }, _eventsCount: 7, _maxListeners: undefined, outputData: [], outputSize: 0, writable: true, destroyed: false, _last: true, chunkedEncoding: false, shouldKeepAlive: false, maxRequestsOnConnectionReached: false, _defaultKeepAlive: true, useChunkedEncodingByDefault: false, sendDate: false, _removedConnection: false, _removedContLen: false, _removedTE: false, _contentLength: 0, _hasBody: true, _trailer: '', finished: true, _headerSent: true, _closed: false, socket: <ref 2> TLSSocket { _tlsOptions: { allowHalfOpen: undefined, pipe: false, secureContext: SecureContext { context: SecureContext {} }, isServer: false, requestCert: true, rejectUnauthorized: true, session: undefined, ALPNProtocols: undefined, requestOCSP: undefined, enableTrace: undefined, pskCallback: undefined, highWaterMark: undefined, onread: undefined, signal: undefined }, _secureEstablished: true, _securePending: false, _newSessionPending: false, _controlReleased: true, secureConnecting: false, _SNICallback: null, servername: 'www.tiktok.com', alpnProtocol: false, authorized: true, authorizationError: null, encrypted: true, _events: [Object: null prototype] { close: [ [Function: onSocketCloseDestroySSL], [Function: bound onceWrapper] { listener: [Function (anonymous)] }, [Function: onClose], [Function: socketCloseListener] ], end: [Function: onReadableStreamEnd], newListener: [Function: keylogNewListener], secure: [Function: onConnectSecure], session: [Function (anonymous)], free: [Function: onFree], timeout: [Function: onTimeout], agentRemove: [Function: onRemove], error: [Function: socketErrorListener] }, _eventsCount: 9, connecting: false, _hadError: false, _parent: null, _host: 'www.tiktok.com', _readableState: ReadableState { objectMode: false, highWaterMark: 16384, buffer: BufferList { head: null, tail: null, length: 0 }, length: 0, pipes: [], flowing: true, ended: true, endEmitted: true, reading: false, constructed: true, sync: false, needReadable: false, emittedReadable: false, readableListening: false, resumeScheduled: false, errorEmitted: false, emitClose: false, autoDestroy: true, destroyed: true, errored: null, closed: true, closeEmitted: true, defaultEncoding: 'utf8', awaitDrainWriters: null, multiAwaitDrain: false, readingMore: false, dataEmitted: true, decoder: null, encoding: null,
}, cause: Error: unexpected end of file at BrotliDecoder.zlibOnError [as onerror] (node:zlib:189:17) { errno: -5, code: 'Z_BUF_ERROR' } }
Node.js v17.9.1