Giter Site home page Giter Site logo

Comments (42)

weteta avatar weteta commented on May 16, 2024 2
this.connection = new WebcastPushConnection(uniqueId, {
	requestHeaders: {
		"Cookie": "sessionid=f6324878b8b34dbb8f86f1a2aafe5a0a;",
	},
});

Only this here solved my problem, I didn't put the ttwid and it worked normal

from tiktok-live-connector.

diazndc avatar diazndc commented on May 16, 2024 1

@zerodytrash yep the new version is working, thank you!

Also it is working without the sessionid or ttwid.

from tiktok-live-connector.

renelima avatar renelima commented on May 16, 2024

Here it also stopped working

from tiktok-live-connector.

adierebel avatar adierebel commented on May 16, 2024

maybe tiktok update their webcats, no event sent

from tiktok-live-connector.

renelima avatar renelima commented on May 16, 2024

Could it be that live-connector no longer works?

from tiktok-live-connector.

OlegShklyarov avatar OlegShklyarov commented on May 16, 2024

Seems so. Waiting for Zerody

from tiktok-live-connector.

OlegShklyarov avatar OlegShklyarov commented on May 16, 2024

maybe our time has come. To go to the factory

from tiktok-live-connector.

asdfg314284230 avatar asdfg314284230 commented on May 16, 2024

I have the same problem

from tiktok-live-connector.

pbreit1988 avatar pbreit1988 commented on May 16, 2024

Same Problem

from tiktok-live-connector.

zerodytrash avatar zerodytrash commented on May 16, 2024

Seems like TikTok no longer allows access to the webcast service without authentication.
Adding a valid sessionid and the ttwid cookie seems to fix the problem.

let tiktokChatConnection = new WebcastPushConnection('kingmohehe', {
    requestHeaders: {
        "Cookie": "sessionid=f6324878b8b34dbb8f86f1a2aafe5a0a; ttwid=1%7CLw5aVXrdJshrcdKNG2-zgC617ecDJ2WsxVHMymzZArQ%7C1658320010%7C03913e3ebc15cda442d9164e4f3f426544564573935abce01da09a557fa5130b;",
    },
    websocketHeaders: {
        "Cookie": "sessionid=f6324878b8b34dbb8f86f1a2aafe5a0a; ttwid=1%7CLw5aVXrdJshrcdKNG2-zgC617ecDJ2WsxVHMymzZArQ%7C1658320010%7C03913e3ebc15cda442d9164e4f3f426544564573935abce01da09a557fa5130b;",
    }
});

from tiktok-live-connector.

pbreit1988 avatar pbreit1988 commented on May 16, 2024

Can we use all the same source code? Copy Paste? Or must we generate something by our self?

from tiktok-live-connector.

zerodytrash avatar zerodytrash commented on May 16, 2024

Can we use all the same source code? Copy Paste? Or must we generate something by our self?

You need to extract the cookies (sessionid and ttwid) from your browser. The cookies mentioned in the example are invalid.

from tiktok-live-connector.

pbreit1988 avatar pbreit1988 commented on May 16, 2024

Is there not a more elegant solution here? Pre Authentication via Nodejs and extracting the sessionid? I think the problem is that when I'm live I can't watch my own stream at the same time. So it could be that my sessionid does not allow me to connect to the stream.

from tiktok-live-connector.

zerodytrash avatar zerodytrash commented on May 16, 2024

I think the problem is that when I'm live I can't watch my own stream at the same time. So it could be that my sessionid does not allow me to connect to the stream.

The session id is valid for all streams. You don't have to renew it every time.

from tiktok-live-connector.

pbreit1988 avatar pbreit1988 commented on May 16, 2024

Okay i test it. Thank you for your Support.

from tiktok-live-connector.

adierebel avatar adierebel commented on May 16, 2024

Can we use all the same source code? Copy Paste? Or must we generate something by our self?

You need to extract the cookies (sessionid and ttwid) from your browser. The cookies mentioned in the example are invalid.

How to obtain this data? We don't see sessionid and ttwid on browser's cookies

from tiktok-live-connector.

OlegShklyarov avatar OlegShklyarov commented on May 16, 2024

And when user has many channels? He should authorize in the browser first, extract cookies and then put them to the call? For each channels separately?

aKVbQ0m0_700w_0

from tiktok-live-connector.

pbreit1988 avatar pbreit1988 commented on May 16, 2024

I extract the sessionid and the ttwid from my Chrome Browser and set it in the source code. But it not working.

from tiktok-live-connector.

renelima avatar renelima commented on May 16, 2024

Here too! Did not work

from tiktok-live-connector.

asdfg314284230 avatar asdfg314284230 commented on May 16, 2024

It's been solved. thank you

from tiktok-live-connector.

OlegShklyarov avatar OlegShklyarov commented on May 16, 2024

It's been solved. thank you

How? Share you cure, please

from tiktok-live-connector.

OlegShklyarov avatar OlegShklyarov commented on May 16, 2024

Should we change the connectionWrapper?

this.connection = new WebcastPushConnection(uniqueId, options);

from tiktok-live-connector.

OlegShklyarov avatar OlegShklyarov commented on May 16, 2024
this.connection = new WebcastPushConnection(uniqueId, {
	requestHeaders: {
		"Cookie": "sessionid=f6324878b8b34dbb8f86f1a2aafe5a0a;",
	},
});

Only this here solved my problem, I didn't put the ttwid and it worked normal

Thank you for the example. I wonder will it work for any user...

from tiktok-live-connector.

zerodytrash avatar zerodytrash commented on May 16, 2024

And when user has many channels? He should authorize in the browser first, extract cookies and then put them to the call? For each channels separately?

you can connect to as many streams as you want using a single session id. you don't need the session id of the streamer. just use the session of a trash account in the backend.

from tiktok-live-connector.

liessinoudjal avatar liessinoudjal commented on May 16, 2024

it works for me too

from tiktok-live-connector.

zerodytrash avatar zerodytrash commented on May 16, 2024

@OlegShklyarov if you scroll up you will see a complete example. without the ttwid cookie (TikTok websocket ID) the websocket connection will fail and request polling will be used.

from tiktok-live-connector.

OlegShklyarov avatar OlegShklyarov commented on May 16, 2024

I just use this on a client side:

socket.connect(uniqueId, {
    requestHeaders: {
"Cookie": "sessionid=7877777773c2fedf3923ce3c4;",
},
enableWebsocketUpgrade:false,
requestPollingIntervalMs: 500,

For how long is the session valid?

from tiktok-live-connector.

adierebel avatar adierebel commented on May 16, 2024

For how long is the session valid?

90 days

from tiktok-live-connector.

OlegShklyarov avatar OlegShklyarov commented on May 16, 2024

And if I will relog on that browser, session will be terminated?

from tiktok-live-connector.

zerodytrash avatar zerodytrash commented on May 16, 2024

And if I will relog on that browser, session will be terminated?

Simply remove the cookie from the browser and you will be able to log in again without revoking the previous cookie.

from tiktok-live-connector.

diazndc avatar diazndc commented on May 16, 2024

I've been trying to get it to work, but solution presented by zerody don't seem to work for me. Here's a video I made of me retrieving the sessionid and ttwid and inserting it into websocketHeaders and requestHeaders.

It is also not upgrading to websocket. Any ideas?

https://youtu.be/JvHyivp5VWs

from tiktok-live-connector.

zerodytrash avatar zerodytrash commented on May 16, 2024

@diazndc the steps you take and the code looks correct to me. can you check if you have the latest version of the library installed? (v0.9.22)

from tiktok-live-connector.

diazndc avatar diazndc commented on May 16, 2024

@diazndc the steps you take and the code looks correct to me. can you check if you have the latest version of the library >installed? (v0.9.22)

@zerodytrash Yes, this is a test project, freshly installed today with the latest version

{
  "name": "tiktoktest",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "tiktok-live-connector": "^0.9.22"
  }
}

from tiktok-live-connector.

zerodytrash avatar zerodytrash commented on May 16, 2024

@diazndc try to delete all cookies from your browser. log in again. visit a livestream and then take the cookies.

from tiktok-live-connector.

quang1412 avatar quang1412 commented on May 16, 2024

Seems like TikTok no longer allows access to the webcast service without authentication. Adding a valid sessionid and the ttwid cookie seems to fix the problem.

let tiktokChatConnection = new WebcastPushConnection('kingmohehe', {
    requestHeaders: {
        "Cookie": "sessionid=f6324878b8b34dbb8f86f1a2aafe5a0a; ttwid=1%7CLw5aVXrdJshrcdKNG2-zgC617ecDJ2WsxVHMymzZArQ%7C1658320010%7C03913e3ebc15cda442d9164e4f3f426544564573935abce01da09a557fa5130b;",
    },
    websocketHeaders: {
        "Cookie": "sessionid=f6324878b8b34dbb8f86f1a2aafe5a0a; ttwid=1%7CLw5aVXrdJshrcdKNG2-zgC617ecDJ2WsxVHMymzZArQ%7C1658320010%7C03913e3ebc15cda442d9164e4f3f426544564573935abce01da09a557fa5130b;",
    }
});

It's been solved. thank you

from tiktok-live-connector.

diazndc avatar diazndc commented on May 16, 2024

@diazndc try to delete all cookies from your browser. log in again. visit a livestream and then take the cookies.

I've tried that. Tried also in a incognito window. Tried clearing not only cookies, but session storage and local storage aswell. I'll post another video soon trying your latest recomendation. Just to make sure.

from tiktok-live-connector.

tranvanduong2483 avatar tranvanduong2483 commented on May 16, 2024

Work for me, thanks @zerodytrash !

from tiktok-live-connector.

diazndc avatar diazndc commented on May 16, 2024

@zerodytrash here's a new attempt recorded https://youtu.be/aBmTo9--xx4

Could it be that webcast is being asked for an "if it's a robot" challenge?

BTW i'm using Node v16.16.0 and a Mac. Should I change the user-agent to

user-agent: Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Mobile Safari/537.36

Edit:
So I updated my Mac from Big Sur to Monterey, still didnt work then, proceeded to deleted a bunch of stuff to make space to update xcode, started to update xcode. And all of the sudden without xcode finishing updating it works. Same sessionid and ttwid used, it just started working.

from tiktok-live-connector.

zerodytrash avatar zerodytrash commented on May 16, 2024

@diazndc it probably works because i have released a new version v0.9.23.
In this version, a sessionid may no longer be required.
maybe someone can test and confirm this.

update command: npm i tiktok-live-connector

from tiktok-live-connector.

diazndc avatar diazndc commented on May 16, 2024

@zerodytrash i still had 0.9.22 when it worked, now it stopped working again WebcastResponse.data.Buffer is always empty, again. I will update to the new version and see if it works

from tiktok-live-connector.

linhnguyen9988 avatar linhnguyen9988 commented on May 16, 2024

@diazndc it still need sessionId but in 0.9.23 backend do it for you

from tiktok-live-connector.

quang1412 avatar quang1412 commented on May 16, 2024

all events stopped working :(((

from tiktok-live-connector.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.