Giter Site home page Giter Site logo

zerodytrash / tiktok-live-connector Goto Github PK

View Code? Open in Web Editor NEW
1.1K 39.0 238.0 241 KB

Node.js library to receive live stream events (comments, gifts, etc.) in realtime from TikTok LIVE.

Home Page: https://discord.gg/2c6kX6g3Pa

License: MIT License

JavaScript 100.00%
tiktok tiktok-api tiktok-live chat chat-reader connector stream scraper webcast javascript

tiktok-live-connector's People

Contributors

bryanbassett avatar carcabot avatar endergamingfilms avatar filterunfiltered avatar isaackogan avatar nealnote avatar vladisl0ve avatar zerodytrash avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tiktok-live-connector's Issues

Can't find the user.

Hi!
When i try to read a chat live, the package don't find the user, i followed the guide but it wont work
I have cloned the public website too but it's isnt working, it's working only your website.

Error: Failed to extract room_id from page source. User might be offline.

Unable to import within default ReactJS App (create-react-app)

Trying to use this package within a React site causes an error:

webcastWebsocket.js:26 Uncaught TypeError: Class extends value undefined is not a constructor or null
    at Object../node_modules/tiktok-live-connector/dist/lib/webcastWebsocket.js (webcastWebsocket.js:26:1)
    at Object.options.factory (react refresh:6:1)
    at __webpack_require__ (bootstrap:24:1)
    at fn (hot module replacement:62:1)
    at Object../node_modules/tiktok-live-connector/dist/index.js (index.js:27:1)
    at Object.options.factory (react refresh:6:1)
    at __webpack_require__ (bootstrap:24:1)
    at fn (hot module replacement:62:1)
    at Object../node_modules/tiktok-live-connector/index.js (index.js:1:1)
    at Object.options.factory (react refresh:6:1)

This issue suggests it is a circular import: https://stackoverflow.com/questions/37312197/node-js-v6-2-0-class-extends-is-not-a-function-error/ (but I don't think that's the reason)

This is the code for that file:

import {Component} from "react";
const { WebcastPushConnection } = require('tiktok-live-connector');

class Test extends Component {

    render() {

        return (
            <div />
        )
    }

}

export default Test;

Error to connect

We have an error on the launch, Failed to connect Error: Failed to retrieve room_id from page source. mainPageHtml.match is not a function

The error is on the demo too

image

Error in the demo

Hello, i'm getting this error in your demo since some hours.
Error: Failed to retrieve room_id from page source. mainPageHtml.match is not a function

Axios proxy bug

Turns out axios is a dump when it comes to proxies, and the default env proxy configurations cause axios to crash;
axios/axios#3384

Not sure if there's a fix available, but would be nice to be able to use proxies here

.webp format not supported by unity

(feature) get sessionId

Hello,

Is there any way we can get sessionId from user's credentials ? If yes, I would gladly help.

Strange issue with gift-repeat

Hello,

There seems to be a new strange issue with the data.gift.repeat_end = 1 not firing, but only for some gifters. I've made sure everything is up to date, and have even tried pointing the https://tiktok-chat-reader.zerody.one/ demo at a room.

From what I can tell, it seems to effect Australian gifters (not the host). I pointed the demo at an Australian live and these gifts of 1 roses show a red x1 that never turn black.
image

Point it at an American live and they turn black (indicating the repeat_end gift event fired):
image

Had the gifter try the same American room and only the initial gift (repeat_end = 0) fired in the same way as the Australian one.

Treasure Box / WebcastEnvelopeMessage

Hi!

First I like to say thanks for your great work, it's very helpful for me right now!

For the project I'm working on I need to receive infos, if someone gifted a treasure box, that everyone in the room can open and may receive some coins. This box is unfortunately not part of the gift list. Is there a way to retrieve infos about it?

After scanning the raw Webcast I think, the WebcastEnvelopeMessage may contain the searched infos, but i'm too dumb to get the raw data decoded... 😕

check streamer is live

tiktokChatConnection.connect() shows isConnected: true although the streamer is not streaming anymore. If I go via the url https://www.tiktok.com/@user/live there is a black screen and a text with "LIVE has ended 2.5K viewers".

How to check if the streamer goes live?

Saving chat data to *.txt file

Hey, thats really good idea to make that script. It will helps to make the shows more interactive.
Can you add an ability to save all that data to txt-file in real-time?
(honestly I need the function to forward that data to com-port, but txt-file is fine too)

/

no information

Failed to sign request: Request failed with status code 502

Failed to connect Error: Failed to sign request: Request failed with status code 502; URL: https://webcast.tiktok.com/webcast/im/fetch/?aid=1988&app_language=en-US&app_name=tiktok_web&browser_language=en&browser_name=Mozilla&browser_online=true&browser_platform=Win32&browser_version=5.0+%28Windows+NT+10.0%3B+Win64%3B+x64%29+AppleWebKit%2F537.36+%28KHTML%2C+like+Gecko%29+Chrome%2F102.0.5005.63+Safari%2F537.36&cookie_enabled=true&cursor=&internal_ext=&device_platform=web&focus_state=true&from_page=user&history_len=4&is_fullscreen=false&is_page_visible=true&did_rule=3&fetch_rule=1&identity=audience&last_rtt=0&live_id=12&resp_content_type=protobuf&screen_height=1152&screen_width=2048&tz_name=Europe%2FBerlin&referer=https%3A%2F%2Fwww.tiktok.com%2F&root_referer=https%3A%2F%2Fwww.tiktok.com%2F&version_code=180800&webcast_sdk_version=1.3.0&update_version_code=1.3.0&room_id=7123874059737205509
at signRequest (/Users/jeremylai/Documents/node/node_modules/tiktok-live-connector/dist/lib/tiktokSignatureProvider.js:81:11)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async TikTokHttpClient._buildUrl2 (/Users/jeremylai/Documents/node/node_modules/tiktok-live-connector/dist/lib/tiktokHttpClient.js:98:15)
at async TikTokHttpClient.getDeserializedObjectFromWebcastApi (/Users/jeremylai/Documents/node/node_modules/tiktok-live-connector/dist/lib/tiktokHttpClient.js:63:15)
at async WebcastPushConnection._fetchRoomData2 (/Users/jeremylai/Documents/node/node_modules/tiktok-live-connector/dist/index.js:500:25)
at async WebcastPushConnection.connect (/Users/jeremylai/Documents/node/node_modules/tiktok-live-connector/dist/index.js:269:7)

Newbie here: get SyntaxError: Invalid or unexpected token

SyntaxError: Invalid or unexpected token
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:549:28)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)

I have copy pasted the example and started an app.js

Failed to sign request: Request failed with status code 429

Failed to connect Error: Failed to sign request: Request failed with status code 429; URL: https://webcast.tiktok.com/webcast/im/fetch/?aid=1988&app_language=en-US&app_name=tiktok_web&browser_language=en&browser_name=Mozilla&browser_online=true&browser_platform=Win32&browser_version=5.0+%28Windows+NT+10.0%3B+Win64%3B+x64%29+AppleWebKit%2F537.36+%28KHTML%2C+like+Gecko%29+Chrome%2F102.0.5005.63+Safari%2F537.36&cookie_enabled=true&cursor=&internal_ext=&device_platform=web&focus_state=true&from_page=user&history_len=4&is_fullscreen=false&is_page_visible=true&did_rule=3&fetch_rule=1&identity=audience&last_rtt=0&live_id=12&resp_content_type=protobuf&screen_height=1152&screen_width=2048&tz_name=Europe%2FBerlin&referer=https%3A%2F%2Fwww.tiktok.com%2F&root_referer=https%3A%2F%2Fwww.tiktok.com%2F&version_code=180800&webcast_sdk_version=1.3.0&update_version_code=1.3.0&room_id=7125454688937397018
at signRequest (d:\PROJECTS\2dGame\canvas-boilerplate\node_modules\tiktok-live-connector\dist\lib\tiktokSignatureProvider.js:79:11)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async TikTokHttpClient._buildUrl2 (d:\PROJECTS\2dGame\canvas-boilerplate\node_modules\tiktok-live-connector\dist\lib\tiktokHttpClient.js:98:15)
at async TikTokHttpClient.getDeserializedObjectFromWebcastApi (d:\PROJECTS\2dGame\canvas-boilerplate\node_modules\tiktok-live-connector\dist\lib\tiktokHttpClient.js:63:15)
at async WebcastPushConnection._fetchRoomData2 (d:\PROJECTS\2dGame\canvas-boilerplate\node_modules\tiktok-live-connector\dist\index.js:499:25)
at async WebcastPushConnection.connect (d:\PROJECTS\2dGame\canvas-boilerplate\node_modules\tiktok-live-connector\dist\index.js:268:7) {stack: 'Error: Failed to sign request: Request failed…es\tiktok-live-connector\dist\index.js:268:7)', message: 'Failed to sign request: Request failed with …rsion_code=1.3.0&room_id=7125454688937397018'}

[Feature Request] React Js Compatibility

I am currently trying to create a react js app and wanted to be able to import this library. I have had no luck finding a workaround so maybe a feature request would be the right direction?

WebcastGiftMessage

can you show an example of how to get the image and name of the gift? and other information

Duplicate chat events

Hi there! Great work on this, it was a lifesaver for me.

One issue I'm running into: when chat events come through, if there isn't immediate other chat messages to push it offscreen, those same chat events run again when it looks for more events (e.g. user 1 comments "hi" once, but the on("chat"... with that data comes through multiple times. I figured one way to filter it out was to grab the timestamp of the chat message and just make sure I keep a log of previously seen messages, but I can't seem to figure out where to find that kind of stamp info. Is there a way I could modify the lib myself locally to add that data? I tried adding msgId or timestamp to the proto for WebcastChatMessage but neither of those seem to have any affect on the results returned.

Cannot read 'security' of undefined

When I am trying to use this library in node, I get the error it cannot read 'security' of undefined as error.

The channel is live and using the sample code.

403 profile picture error

Hello. A lot of profile pictures started to return a 403 error. Can you tell me what is the reason for this?

mobile chat

Are you planning to add a mobile chat parser?
there are more tap events

Live Connector not work anymore

The Live Connector worked perfectly until yesterday. Today sometimes the Events Fires and sometimes nothing is received. The Connection seems to be established. I get no Errors.

I can not see likes and followers

Hello! In Server.js I have added

        thisConnection.on('like', msg => socket.emit('like', msg));
        thisConnection.on('social', msg => socket.emit('social', msg));

In public app I have this:

socket.on('like', function(msg){
console.log("like");
console.log(msg.totalLikeCount);
});

socket.on('social', function(){
console.log("follow");
});

And there are no alerts coming. Gifts and chat are working fine. What am I doing wrong?

Node.js settings

Could you please suggest me best node.js app starting settings? I run it like this with no additional variables:

forever start app.js

And my connection to the socket is not always stable. maybe because wrong node.js starting values? The connection stops sometimes with xhr post error.

Any list of all gift IDs?

Trying to find all the gift ID's is a bit tedious since some are a lot more rare than others. Do you have a list that I could use?

websocket: false

when i try to start the server in visualstudio code i get this error websocket: false
has happened to someone else thanks

Not retrieving all of the gift event data.

Screenshot 2022-04-28 203629

I've encountered an issue where it seems like it's only importing all of the data for some gift events. With others, it seems to only be importing the "sender details". I console.log() all of the data and that's all that's showing. It seems to only be happening with some users. Not sure if I'm doing something wrong.

Current viewers

Would it be possible to list the viewers that are watching the live under the number of viewers please

TT ignores some words sent in chat

Hello, is this TT issue? When I type these words in chat (any of them) they do not appear in msg.comment.
Do you have any ideas why? They are not offensive or something. Just usual things.

рогатка помощь абзац стадо

topGifterRank return null

i try to log topGifterRank. but it's always return null

my code :

tiktokChatConnection.on('chat', data => {
    console.log('name : ' + data.nickname + ' | rank : ' + data.topGifterRank);
});

i'm sure use of latest version:
my package-lock.json:

"tiktok-live-connector": {
      "version": "0.9.21",
      "resolved": "https://registry.npmjs.org/tiktok-live-connector/-/tiktok-live-connector-0.9.21.tgz",
      "integrity": "sha512-6Zhu1NLqd84h5OjGcfyMct7sz8/d1PfuA0sonLpWLPjgH5jCVSr2eIpVEwTucmAph1HpM6NqvxLQtlItpiM1Wg==",
      "requires": {
        "axios": "^0.25.0",
        "protobufjs": "^6.11.2",
        "websocket": "^1.0.34"
      }
    },

[FEATURE REQUEST] TikTok Live Battles

Requesting that you add functionality to capture, display and log TikTok Live battle scores (along with opponent name).

EDIT: Also requesting a checkbox/tickbox to enable/disable timestamps next to all events (gifts, likes, shares, follows, chat messages, etc.)

EDIT 2: Also requesting that the MODERATOR label and NEW GIFTER label is added next to usernames as appropriate

Emit RoomInfo to the client

Hello, I am trying to show HLS link in client`s console after connect.

I have added this to connectionWrapper:

	this.connection.getRoomInfo().then(roomInfo => {
		this.log(`HLS URL: ${roomInfo.stream_url.flv_pull_url.HD1}`);
		this.emit(`HLS URL: ${roomInfo.stream_url.flv_pull_url.HD1}`);
		})

But client does not receive it, it is visible only only in bash console.

Can I join room with current info user ?

  • It's seems join room as a guest user now, right ?
  • The feature "Chat in live stream" use current sessionId to send message, it's awsome. So How I can join room with current info while I logged in ?.
  • I try to push cookie to api /room/enter but it isn't working for me.

WebcastLiveIntroMessage proto

Noticed the WebcastLiveIntroMessage is not implemented in the proto file.

I'd create the proto myself but I'm not sure how you managed to RE the proto definitions.

This is a base64 encoded example:

CiMKF1dlYmNhc3RMaXZlSW50cm9NZXNzYWdlEIGWlPyS17qQYhCBlpT8kte6k
GIYASJOUmVhbCBsaWZlIGh1bWFub2lkIHJvYm90LiBTZW5kIHlvdXIgcXVlc3Rpb25zIGFuZCBmbG93ZXJzIGZvciByZWFsIHJvYm90IEFsZXguKp0ECIGIgO6
t6+64XxoIUHJvbW9ib3RKmQMKqgFodHRwczovL3AxNi1zaWduLXNnLnRpa3Rva2Nkbi5jb20vYXdlbWUvMTAweDEwMC90b3MtYWxpc2ctYXZ0LTAwNjgvMDNjZ
jk4ZDc0MmUwNmI5YWI5MGY3NmE0OTM4ODZiMGIud2VicD94LWV4cGlyZXM9MTY0NjQwOTYwMCZ4LXNpZ25hdHVyZT1GdnpDQU1yRTZzekZ3THJLbFZ0MVUlMkJ
EVDFHSSUzRAqsAWh0dHBzOi8vcDE2LXNpZ24tc2cudGlrdG9rY2RuLmNvbS9hd2VtZS8xMDB4MTAwL3Rvcy1hbGlzZy1hdnQtMDA2OC8wM2NmOThkNzQyZTA2Y
jlhYjkwZjc2YTQ5Mzg4NmIwYi5qcGVnP3gtZXhwaXJlcz0xNjQ2NDA5NjAwJngtc2lnbmF0dXJlPUlHJTJGOW5IeGl0bCUyRmxGbTRoODREREd4eWN5R3clM0Q
SOzEwMHgxMDAvdG9zLWFsaXNnLWF2dC0wMDY4LzAzY2Y5OGQ3NDJlMDZiOWFiOTBmNzZhNDkzODg2YjBisgEGCBwQoctiggIAsgIPcHJvbW9ib3Qucm9ib3Rz8
gJMTVM0d0xqQUJBQUFBQzF5SXlyOGhSbkFkcG8xS2NaNTRpeXh1Sll2TTh4MUIwUWkxcmVuZ2VVT1FHTDJpak5ycUwxTk8wcEhaaW1aMToYCAKqARMIAhIPcG1
fbXRfaG9zdGxhYmVs

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.