Comments (42)
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.
@zerodytrash yep the new version is working, thank you!
Also it is working without the sessionid or ttwid.
from tiktok-live-connector.
Here it also stopped working
from tiktok-live-connector.
maybe tiktok update their webcats, no event sent
from tiktok-live-connector.
Could it be that live-connector no longer works?
from tiktok-live-connector.
Seems so. Waiting for Zerody
from tiktok-live-connector.
maybe our time has come. To go to the factory
from tiktok-live-connector.
I have the same problem
from tiktok-live-connector.
Same Problem
from tiktok-live-connector.
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.
Can we use all the same source code? Copy Paste? Or must we generate something by our self?
from tiktok-live-connector.
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.
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.
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.
Okay i test it. Thank you for your Support.
from tiktok-live-connector.
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
andttwid
) 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.
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?
from tiktok-live-connector.
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.
Here too! Did not work
from tiktok-live-connector.
It's been solved. thank you
from tiktok-live-connector.
It's been solved. thank you
How? Share you cure, please
from tiktok-live-connector.
Should we change the connectionWrapper?
this.connection = new WebcastPushConnection(uniqueId, options);
from tiktok-live-connector.
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.
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.
it works for me too
from tiktok-live-connector.
@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.
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.
For how long is the session valid?
90 days
from tiktok-live-connector.
And if I will relog on that browser, session will be terminated?
from tiktok-live-connector.
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.
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?
from tiktok-live-connector.
@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 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.
@diazndc try to delete all cookies from your browser. log in again. visit a livestream and then take the cookies.
from tiktok-live-connector.
Seems like TikTok no longer allows access to the webcast service without authentication. Adding a valid
sessionid
and thettwid
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 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.
Work for me, thanks @zerodytrash !
from tiktok-live-connector.
@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.
@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.
@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.
@diazndc it still need sessionId but in 0.9.23 backend do it for you
from tiktok-live-connector.
all events stopped working :(((
from tiktok-live-connector.
Related Issues (20)
- Websocket error
- Every few minutes, the connection stops, possibly due to Cloudflare implemented on TikTok. This issue also exists in the Python version
- TypeError: ProxyAgent is not a constructor
- ranked members joining not detected HOT 1
- Parse Error HOT 5
- Error: Failed to fetch room info. timeout of 10000ms exceeded
- Too Many Requests [429] HOT 2
- [Bug] Unhandled "Interval" when process is shutdown leading to application Timeouts.
- Too Many Requests [429] HOT 2
- [Bug] Connected to the live room and no data was received after that HOT 6
- More info on these config URLs
- Websocket connection failed, Error: Expected a Sec-WebSocket-Protocol header. HOT 6
- Error: Request failed with status code 429 HOT 3
- [Question] Any way to obtain a real-time list of the most viewed live streams on the platform?
- How can I contact you?
- Too Many Requests [429]
- Failed to connect Error: Missing cursor in initial fetch response. HOT 12
- Not continue listening after the StreamEnd
- liveIntro event always saying "Kommt auf denn Server drauf!!!" HOT 1
- Request failed with status code 503 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tiktok-live-connector.