Comments (3)
Same problem here
I cannot find any reliable method to check live true/false
from tiktok-live-connector.
So I created the TikTok Live Connector as a tool to check whether this username is live or not within a certain period of time. This is what the code looks like
const { WebcastPushConnection } = require('tiktok-live-connector'); let tiktok = new WebCastPushConnection('username'); let connected = false; setInterval(()=> { if(connected === true) return; tiktok.connect().then((stats) => console.log(stats.roomId)).catch((err) => console.error(err)); }, 60000); tiktok.on('StreamEnd', () => { if(connected){ connected = false; } });Sometimes this code runs very well, but sometimes it also reads that the user is live even though the user is offline. maybe someone has an idea about this?
This functionality is implemented in the python version.
https://github.com/isaackogan/TikTokLive?tab=readme-ov-file#checking-if-a-user-is-live
from tiktok-live-connector.
i just added a conditional value like this
if(Object.keys(stat.roomInfo).length > 2){
console.log('user live & send message');
}
so when the library suddenly connect to room even the user is offline, the roomInfo is empty so we can do like tiktok.disconnect() first and then we try to connect to check the user live or not.
from tiktok-live-connector.
Related Issues (20)
- Too Many Requests [429] HOT 2
- [Bug] Connected to the live room and no data was received after that HOT 8
- 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 4
- [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
- Websocket connection failed, Error: Server responded with a non-101 status: 200 OK... HOT 4
- Error: TikTok does not offer a websocket upgrade. Please provide a valid `sessionId` to use request polling instead. HOT 5
- Asc
- Error: TikTok does not offer a websocket upgrade. Please provide a valid `sessionId` to use request polling instead HOT 7
- Error: Failed to retrieve room_id from page source. Request failed with status code 403 HOT 1
- Suddenly connected to offline user
- Error: Request failed with status code 500
- Error: Request failed with status code 500 HOT 6
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.