Coder Social home page Coder Social logo

gotiktoklive's People

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

gotiktoklive's Issues

Bug in GetUserInfo

(*TikTok).GetUserInfo will fail for some users, regardless if they are Live. Here is a sample of the panic report:

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x1 addr=0x100 pc=0x1039c5a]

goroutine 1 [running]:
github.com/Davincible/gotiktoklive.(*TikTok).GetUserInfo([omitted])
     [omitted]/github.com/!davincible/[email protected]/tiktok.go:125 +0x27a

The culprit is a map access for the user info parsed out of the webpage, line 125 of tiktok.go:

 84: func (t *TikTok) GetUserInfo(user string) (*UserInfo, error) {
         ...

109:    // Parse json data
110:    var res struct {
111:        UserModule struct {
112:            Users map[string]*UserInfo `json:"users"`
113:            Stats map[string]UserStats `json:"stats"`
114:        } `json:"UserModule"`
115:    }
        ...

124:    userInfo := res.UserModule.Users[user]
125:    userInfo.Stats = res.UserModule.Stats[user]
126:    return userInfo, nil
127: }

TrackUser - Live Room does not working

Hello @Davincible,

The source code of this repository does not work when I want to track user's live room. It gets an unexpected status code of 200 while trying to upgrade the connection from http to webscoket. However, its javascript version of it: https://github.com/zerodytrash/TikTok-Live-Connector works as expected.

I checked all the above compared with the working solution at repository: zerodytrash/TikTok-Live-Connector. Here is what I found:

The URL for the websocket connection request is the same in both solutions, except for the room ID query parameter. The working solution includes the room ID as a query parameter using the live_id key, while the non-working solution does not. This may be required by the TikTok server to establish a connection.

The headers for the websocket connection request are different in both solutions. The working solution sends a header named x-tt-webcast-chat-version with the value of chatVersion from the webcast state object, while the non-working solution does not send any headers. This may be required by the TikTok server to verify the chat version and prevent outdated clients from connecting.

I would suggest to:

  • Update the URL for the websocket connection request to include the room ID as a query parameter using the live_id key.

  • Add a header named x-tt-webcast-chat-version with the value of chatVersion from the webcast state object when connecting to the websocket server.

I have tried to make the changes but couldn't find the webcast state information, also I found that the proto types differs between these two repositories.

Could you please fix the issue? I will be glad to sponsor you as well.

Trouble installing

When I try to install, it outputs:

go: go.mod file not found in current directory or any parent directory.
'go get' is no longer supported outside a module.
To build and install a command, use 'go install' with a version,
like 'go install example.com/cmd@latest'
For more information, see https://golang.org/doc/go-get-install-deprecation
or run 'go help get' or 'go help install'.

So then I use go install github.com/Davincible/gotiktoklive@latest and get:

go: downloading github.com/Davincible/gotiktoklive v0.0.0-20220523132158-127857a3f5b6
go: github.com/Davincible/gotiktoklive@latest (in github.com/Davincible/[email protected]):
The go.mod file for the module providing named packages contains one or
more replace directives. It must not contain directives that would cause
it to be interpreted differently than if it were the main module.

stopped after print "Started polling"

this project is so great and thank you for your working.

I followed the Getting Started in README but removed live.DownloadStream() lines, the code stopped after print "Started polling", any suggestions?

here is the code (i omitted the proxy addr and user ID)

package main

import (
	"fmt"

	"github.com/Davincible/gotiktoklive"
)

func main() {
	tiktok := gotiktoklive.NewTikTok()
	tiktok.SetProxy("http://.........", true)

	// Track a TikTok user by username
	live, err := tiktok.TrackUser("......")
	if err != nil {
		panic(err)
	}

	// Receive livestream events through the live.Events channel
	for event := range live.Events {
		switch e := event.(type) {

		// You can specify what to do for specific events. All events are listed below.
		case gotiktoklive.UserEvent:
			fmt.Printf("%T : %s %s\n", e, e.Event, e.User.Username)

		// List viewer count
		case gotiktoklive.ViewersEvent:
			fmt.Printf("%T : %d\n", e, e.Viewers)

		// Specify the action for all remaining events
		default:
			fmt.Printf("%T : %+v\n", e, e)
		}
	}
}

Message protobuf type has not been implemented, please report: WebcastRoomPinMessage

Great project! Love it. I have an issue when i try to create main class and main func and run basic commands.

For instance; when try to get live stream like this

func main() {

	// Create TikTok Instance
	tiktok := gotiktoklive.NewTikTok()

	// Track a TikTok user by username
	live, err := tiktok.TrackUser("mikailasmodays")
	if err != nil {
		panic(err)
	}

	// Start downloading stream
	// Make sure you have the ffmpeg binary installed, and present in your path.
	if err := live.DownloadStream(); err != nil {
		panic(err)
	}
}

i get an error like this;

message protobuf type has not been implemented, please report: WebcastRoomPinMessage,
CjQKFVdlYmNhc3RSb29tUGluTWVzc2FnZRCFluSwi9ee4GMYhZbA3tGFneBjIMeM/r7aMDABEp8RChYQhZawlN/WnuBjGIWWwN7RhZ3gYzABEpcQCIGIipCE9ejrYBoh8J+UpVTDnExBWVnwn5SlQXogaW5zYW4gw7Z6IGluc2FuSpIDCqgBaHR0cHM6Ly9wMTYtc2lnbi12YS50aWt0b2tjZG4uY29tL3Rvcy1tYWxpdmEtYXZ0LTAwNjgvNGYxNDk0YjE4YWI5MmI3YTIzNDM2OWU3NGYxNTU5NmF+YzVfMTAweDEwMC53ZWJwP3gtZXhwaXJlcz0xNjczNzMwMDAwJngtc2lnbmF0dXJlPXVtclBRSERzaW9Cb29MQSUyRkI0UVNRS25pM25ZJTNECqYBaHR0cHM6Ly9wMTYtc2lnbi12YS50aWt0b2tjZG4uY29tL3Rvcy1tYWxpdmEtYXZ0LTAwNjgvNGYxNDk0YjE4YWI5MmI3YTIzNDM2OWU3NGYxNTU5NmF+YzVfMTAweDEwMC5qcGVnP3gtZXhwaXJlcz0xNjczNzMwMDAwJngtc2lnbmF0dXJlPWVOWjBEWjNLd05jNkZiR0M0akhNZ1I2Z25NWSUzRBI8MTAweDEwMC90b3MtbWFsaXZhLWF2dC0wMDY4LzRmMTQ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EwggQVCAQQChgBIAJYAWIJCgEwEgEwGgEwggQVCAQQChgDIAJYAWIJCgEwEgEwGgEwokATNjk3ODIyNjA5MDY5MTE2NzIzMxpe8J+UpVlBWUlOSU1JWiBIRUTEsFlFTMSwRMSwUiDwn5Sl8J+RiFRFSyBTT1JVIDUwSkVUT04g8J+UpURFVEFZTEkgQkFLSU0gIFBBUkEgWUHEnk1VUlVEVVIg8J+RiHICdHKSAQYYASABKAHyARJXZWJjYXN0Q2hhdE1lc3NhZ2X4AceM/r7aMIICDwiBiIqQhPXo62CCAgIQAYgCAZAC////////////AZgChZbksIvXnuBj
panic: Connection upgrade failed: Failed to connect: unexpected HTTP response status: 200

goroutine 1 [running]:
main.main()
        C:/Users/beefe/IdeaProjects/gotiktoklive/main/main.go:16 +0x325

Process finished with the exit code 2

I found user (it was on live stream, i checked my phone application also) but i didin't fetch live stream data. I download ffmpeg and add it to the PATH.
I have checked Probuf Decoder and Protobuf website but i didin't get anything... Any advice for new setup? Do i miss any third party library?

Failed to send request to webcast/sign_url/

I am getting this error message when fetching live-room information.

Started polling
panic: Failed to send request to im/fetch/: Failed to sign request: Failed to send request to webcast/sign_url/: you have exceeded the rate limit, please wait a few min

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.