zerodytrash / TikTok-Live-Connector

Node.js library to receive live stream events (comments, gifts, etc.) in realtime from TikTok LIVE.
https://discord.gg/2c6kX6g3Pa
MIT License
1.28k stars 276 forks source link

Error: TikTok does not offer a websocket upgrade. Please provide a valid `sessionId` to use request polling instead #187

Open jetLuoxianjie opened 3 months ago

jetLuoxianjie commented 3 months ago

Error: TikTok does not offer a websocket upgrade. Please provide a valid sessionId to use request polling instead

grobekelle commented 3 months ago

Unfortunately, I´ve the same issue since today.

` WRAPPER @xyz: Error event triggered: Upgrade to websocket failed, Websocket connection failed, Error: Server responded with a non-101 status: 200 OK Response Headers Follow: content-length: 0 handshake-msg: DEVICE_BLOCKED handshake-status: 415 tt_stable: 1 x-tt-trace-host: 01e433ed606f50fe17b03bcce88dcd1fde9f94321462e6c7ccf3289c35a8949125469dd848cb408eb2c5a24babcb6d743c1e413689a8614da286ec866fafafe6991bcdb8834699a16e555e6f7c9077fc56c7d6aa783bf6732ce406b344a11afcd3447ff2a5fed576b83899ea8acaed3294 x-tt-trace-id: 00-24052317233651F5A8C974F807C4E27F-3CDA7A2F25D344A7-00 server: TLB x-tt-logid: 2024052317233651F5A8C974F807C4E27F x-origin-response-time: 23,23.201.31.167 x-akamai-request-id: 3696814f.1a3f6e8d expires: Thu, 23 May 2024 17:23:37 GMT cache-control: max-age=0, no-cache, no-store pragma: no-cache date: Thu, 23 May 2024 17:23:37 GMT x-cache: TCP_MISS from a2-17-34-213.deploy.akamaitechnologies.com (AkamaiGHost/11.5.1-56325026) (-) connection: keep-alive x-cache-remote: TCP_MISS from a23-201-31-167.deploy.akamaitechnologies.com (AkamaiGHost/11.5.0.1-56208139) (-) x-tt-trace-tag: id=16;cdn-cache=miss;type=dyn server-timing: cdn-cache; desc=MISS, edge; dur=85, origin; dur=23, inner; dur=21 x-parent-response-time: 107,2.17.34.213

{ info: 'Upgrade to websocket failed', exception: 'Websocket connection failed, Error: Server responded with a non-101 status: 200 OK\n' + 'Response Headers Follow:\n' + 'content-length: 0\n' + 'handshake-msg: DEVICE_BLOCKED\n' + 'handshake-status: 415\n' + 'tt_stable: 1\n' + 'x-tt-trace-host: 01e433ed606f50fe17b03bcce88dcd1fde9f94321462e6c7ccf3289c35a8949125469dd848cb408eb2c5a24babcb6d743c1e413689a8614da286ec866fafafe6991bcdb8834699a16e555e6f7c9077fc56c7d6aa783bf6732ce406b344a11afcd3447ff2a5fed576b83899ea8acaed3294\n' + 'x-tt-trace-id: 00-24052317233651F5A8C974F807C4E27F-3CDA7A2F25D344A7-00\n' + 'server: TLB\n' + 'x-tt-logid: 2024052317233651F5A8C974F807C4E27F\n' + 'x-origin-response-time: 23,23.201.31.167\n' + 'x-akamai-request-id: 3696814f.1a3f6e8d\n' + 'expires: Thu, 23 May 2024 17:23:37 GMT\n' + 'cache-control: max-age=0, no-cache, no-store\n' + 'pragma: no-cache\n' + 'date: Thu, 23 May 2024 17:23:37 GMT\n' + 'x-cache: TCP_MISS from a2-17-34-213.deploy.akamaitechnologies.com (AkamaiGHost/11.5.1-56325026) (-)\n' + 'connection: keep-alive\n' + 'x-cache-remote: TCP_MISS from a23-201-31-167.deploy.akamaitechnologies.com (AkamaiGHost/11.5.0.1-56208139) (-)\n' + 'x-tt-trace-tag: id=16;cdn-cache=miss;type=dyn\n' + 'server-timing: cdn-cache; desc=MISS, edge; dur=85, origin; dur=23, inner; dur=21\n' + 'x-parent-response-time: 107,2.17.34.213\n' } WRAPPER @xyz: Error event triggered: Error while connecting, Error: TikTok does not offer a websocket upgrade. Please provide a valid sessionId to use request polling instead. { info: 'Error while connecting', exception: Error: TikTok does not offer a websocket upgrade. Please provide a valid sessionId to use request polling instead. at WebcastPushConnection.connect (C:\Node\node_modules\tiktok-live-connector\dist\index.js:300:17) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) } WRAPPER @xyz: Connection failed, Error: TikTok does not offer a websocket upgrade. Please provide a valid sessionId to use request polling instead. `

TTLiveStream commented 3 months ago

FYI The devs are working a solution. Might be down for a bt. There is a new Sign Server upgrade that has recently happened / happening.

bakteribaik commented 3 months ago

Ever try this?

const tiktok = new WebcastPushConnection(username, {
    sessionId: 'put_your_session_id_here'
})

how to get session_Id?

zerodytrash commented 3 months ago

Fixed. Please update the lib to v1.1.7. Thanks.

qrq commented 3 months ago

Hi zerodytrash Updated to v1.1.7 but Not working for me ! also in your demo page still give :

Error: TikTok does not offer a websocket upgrade. Please provide a valid sessionId to use request polling instead

is it need to session id or something like that ?

i hope Unity team work quickly like Mr: zerodytrash

qrq commented 3 months ago

I solve it by replace old index.js by new one , thanks

khaitv0711 commented 3 months ago

I updated to v1.1.7 and also still got: Error: TikTok does not offer a websocket upgrade. Please provide a valid sessionId to use request polling instead

lacozy commented 3 months ago

I still receive the same issue

qrq commented 3 months ago

me too

thesuperankes commented 3 months ago

Same here

fmalk commented 2 months ago

Same, but using sessionId as per documentation works. However, I believe the solution will be to somehow retrieve this ID from a registered Tiktok App (TikTok Developers page), but I couldn't find info regarding how to authenticate my session this way from the API.

My guess is relying on my own user sessionId will either a) be ineffective since I'd have to update my code every time it changes and b) I might have my account blocked using it this way.

f13end commented 1 month ago

Ever try this?

const tiktok = new WebcastPushConnection(username, {
    sessionId: 'put_your_session_id_here'
})

how to get session_Id?

  • open browser
  • go to tiktok.com
  • login
  • press F12
  • go to application tab
  • expand cookies
  • click on link
  • search session_id on that window

Thanks, i will try.

pycreeper commented 2 weeks ago

Error: TikTok does not offer a websocket upgrade. Please provide a valid sessionId to use request polling instead.

I have the same problem and to correct it I have to run "npm update", it happens to me very frequently. Also remember that "npm cache clean --force" is you friend with this script.