gotiktoklive

package module
v0.0.0-...-b8ef93c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 12, 2022 License: MIT Imports: 32 Imported by: 1

README

GoDoc Go Report Card

GoTikTokLive

A Go module to download livestreams and discover, receive and decode livestreams and the livestream events such as comments and gifts in realtime from TikTok LIVE by connecting to TikTok's internal WebCast push service. The package includes a wrapper that connects to the WebCast service using just the username (uniqueId). This allows you to connect to your own live chat as well as the live chat of other streamers. No credentials are required. Besides Chat Comments, other events such as Members Joining, Gifts, Viewers, Follows, Shares, Questions, Likes and Battles can be tracked.

Looking for a Python implementation of this library? Check out TikTok-Live-Connector by @isaackogan

Looking for a Node.js implementation of this library? Check out TikTok-Livestream-Chat-Connector by @zerodytrash

NOTE: This is not an official API, and is no way affiliated to or sponsored by TikTok.

Go rewrite of zerodytrash/TikTok-Livestream-Chat-Connector

Overview

Getting started

  1. Install the package using the Go package manager
go get github.com/Davincible/gotiktoklive
  1. Create your first chat connection
// Create TikTok Instance
tiktok := gotiktoklive.NewTikTok()

// Track a TikTok user by username
live, err := tiktok.TrackUser("promobot.robots")
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)
}

// 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)
    }
}

Methods

// TikTok allows you to track and discover current live streams.
type TikTok struct {

	Debug bool

	// LogRequests when set to true will log all made requests in JSON to debugHandler
	LogRequests bool
}

// NewTikTok creates a tiktok instance that allows you to track live streams
//  and discover current livestreams.
func NewTikTok() *TikTok {}

// TrackUser will start to track the livestream of a user, if live.
// To listen to events emitted by the livestream, such as comments and viewer
//  count, listen to the Live.Events channel.
// It will start a go routine and connect to the tiktok websocket.
func (t *TikTok) TrackUser(username string) (*Live, error) {}

// TrackRoom will start to track a room by room ID.
// It will start a go routine and connect to the tiktok websocket.
func (t *TikTok) TrackRoom(roomId string) (*Live, error) {}

// GetUserInfo will fetch information about the user, such as follwers stats,
//  their user ID, as well as the RoomID, with which you can tell if they are live.
func (t *TikTok) GetUserInfo(user string) (*UserInfo, error) {}

// GetRoomInfo will only fetch the room info, normally available with Live.Info
//  but not start tracking a live stream.
func (t *TikTok) GetRoomInfo(username string) (*RoomInfo, error) {}

// GetPriceList fetches the price list of tiktok coins. Prices will be given in
//  USD cents and the cents equivalent of the local currency of the IP location.
// To fetch a different currency, use a VPN or proxy to change your IP to a
//  different country.
func (t *TikTok) GetPriceList() (*PriceList, error) {}

// NewFeed creates a new Feed instance. Start fetching reccomended livestreams
//  with Feed.Next().
func (t *TikTok) NewFeed() *Feed {}

func (t *TikTok) SetDebugHandler(f func(...interface{})) {}

func (t *TikTok) SetErrorHandler(f func(error)) {}

func (t *TikTok) SetInfoHandler(f func(...interface{})) {}

func (t *TikTok) SetWarnHandler(f func(...interface{})) {}

// SetProxy will set a proxy for both the http client as well as the websocket.
// You can manually set a proxy with this method, or by using the HTTPS_PROXY
//  environment variable.
// ALL_PROXY can be used to set a proxy only for the websocket.
func (t *TikTok) SetProxy(url string, insecure bool) error {}

Events

RoomEvent

Room events are messages broadcast in the room. The most common event, is the Type: SystemMessage at broadcast the beginning a stream gets watched, saying "Welcome to TikTok LIVE! Have fun interacting with others in real-time an d remember to follow our Community Guidelines."

type RoomEvent struct {
	Type    string
	Message string
}
ChatEvent

Chat events are broadcasted when a user posts a chat message, aka comment to a livestream.

type ChatEvent struct {
	Comment   string
	User      *User
	Timestamp int64
}
UserEvent

User events are used when a user either joins the stream, shares the stream, or follows the host.

type UserEvent struct {
	Event userEventType
	User  *User
}

type User struct {
	ID              int64
	Username        string
	Nickname        string
	ProfilePicture  *ProfilePicture
	ExtraAttributes *ExtraAttributes
	Badge           *BadgeAttributes
}

// User Event Types
const (
	USER_JOIN   userEventType = "user joined the stream"
	USER_SHARE  userEventType = "user shared the stream"
	USER_FOLLOW userEventType = "user followed the host"
)
ViewersEvent

Viewer events broadcast the current amount of users watching the livestream.

type ViewersEvent struct {
	Viewers int
}
GiftEvent

Gift events are broadcast when a user buys a gift for the host. To get more information about the gift, such as the price in coins, find the gift by ID in the live.GiftInfo.Gifts.

Gift events with GiftEvent.Type == 1 are streakable, meaning multiple gifts can be sent in sequence, such as roses. For these sequences, multiple events are broadcast. Upon every subsequent gift in the streak, the GiftEvent.RepeatCount will increase by one. To prevent the duplicate processing of streakable gifts, you should only process if event.Type == 1 && event.RepeatEnd, as this will be the final message of the streak, and includes the total number of gifts sent in the streak.

type GiftEvent struct {
	ID          int
	Name        string
	Describe    string
	Cost        int
	RepeatCount int
	RepeatEnd   bool
	Type        int
	ToUserID    int64
	Timestamp   int64
	User        *User
}

type User struct {
	ID              int64
	Username        string
	Nickname        string
	ProfilePicture  *ProfilePicture
	ExtraAttributes *ExtraAttributes
	Badge           *BadgeAttributes
}
LikeEvent

Like events are broadcast when a user likes the livestream. The event includes the number of likes the user sent, as well as new total number of likes.

type LikeEvent struct {
	Likes       int
	TotalLikes  int
	User        *User
	DisplayType string
	Label       string
}
QuestionEvent

Question events are emitted when a question has been posted by a user. It includes the question text, and the user that posted the question.

type QuestionEvent struct {
	Quesion string
	User    *User
}
ControlEvent

Control events are used to broadcast the status of the livestream.

Action values:

  • 3: live stream ended
type ControlEvent struct {
	Action int
}
MicBattleEvent
type MicBattleEvent struct {
	Users []*User
}
BattlesEvent
type BattlesEvent struct {
	Status  int
	Battles []*Battle
}

type Battle struct {
	Host   int64
	Groups []*BattleGroup
}

type BattleGroup struct {
	Points int
	Users  []*User
}
RoomBannerEvent

Room banner event contains the JSON data unmarshaled into an interface that was passed with the message.

type RoomBannerEvent struct {
	Data interface{}
}
IntroEvent

Intro events are broadcast upon connecting to a livestream.

type IntroEvent struct {
	ID    int
	Title string
	User  *User
}

Examples

With a feed instance you can fetch a list of recommended livestreams, and directly start tracking them with a single call.

tiktok := NewTikTok()
feed := tiktok.NewFeed()

// Fetch 5 pages of recommended streams, usually 6 are returned at a time
for i := 0; i < 5; i++ {
	feedItem, err := feed.Next()
	if err != nil {
		panic(err)
	}

	for _, stream := range feedItem.LiveStreams {
		fmt.Printf("%s : %d viewers\n", stream.Room.Owner.Nickname, stream.Room.UserCount)
	}

	if !feedItem.Extra.HasMore {
		break
	}
}

recommendedStreams := feed.LiveStreams

// Start tracking the first stream
live, err := recommendedStreams[0].Track()
if err != nil {
	panic(err)
}

// Process events
...

Error Handling

Gotiktoklive uses Go routines to fetch events using either websockets or HTTP polling. These go routines need an error hander, that defaults to panic. You can overwrite this behavior:

tiktok.SetErrorHandler(func(err error) {
    ...
  })

Contributing

Your improvements are welcome! Feel free to open an issue or pull request.

Documentation

Index

Constants

View Source
const (
	POLLING_INTERVAL         = time.Second
	DEFAULT_EVENTS_CHAN_SIZE = 100
)
View Source
const (
	USER_JOIN   userEventType = "user joined the stream"
	USER_SHARE  userEventType = "user shared the stream"
	USER_FOLLOW userEventType = "user followed the host"
)

Variables

View Source
var (
	ErrUserOffline       = errors.New("user might be offline, Room ID not found")
	ErrIPBlocked         = errors.New("your IP or country might be blocked by TikTok")
	ErrLiveHasEnded      = errors.New("livestream has ended")
	ErrMsgNotImplemented = errors.New("message protobuf type has not been implemented, please report")
	ErrNoMoreFeedItems   = errors.New("no more feed items available")
	ErrUserNotFound      = errors.New("user not found")
	ErrCaptcha           = errors.New("captcha detected, unable to proceed")
	ErrURLNotFound       = errors.New("unable to download stream, URL not found")
	ErrFFMPEGNotFound    = errors.New("please install ffmpeg before downloading")
	ErrRateLimitExceeded = errors.New("you have exceeded the rate limit, please wait a few min")
	ErrUserInfoNotFound  = errors.New("user info not found")
)
View Source
var Direct = direct{}

Direct is a direct proxy: one that makes network connections directly.

View Source
var HttpsDialer = httpsDialer{}

HTTPSDialer is a https proxy: one that makes network connections on tls.

View Source
var TlsConfig = &tls.Config{}

Functions

func FromEnvironment

func FromEnvironment() proxy.Dialer

func FromURL

func FromURL(u *url.URL, forward proxy.Dialer) (proxy.Dialer, error)

Types

type BadgeAttributes

type BadgeAttributes struct {
	Badges []*UserBadge
}

type Battle

type Battle struct {
	Host   int64
	Groups []*BattleGroup
}

type BattleGroup

type BattleGroup struct {
	Points int
	Users  []*User
}

type BattlesEvent

type BattlesEvent struct {
	Status  int
	Battles []*Battle
}

type ChatEvent

type ChatEvent struct {
	Comment   string
	User      *User
	Timestamp int64
}

type ControlEvent

type ControlEvent struct {
	Action int
}

type ExtraAttributes

type ExtraAttributes struct {
	FollowRole int
}

type Feed

type Feed struct {

	// All collected reccomended livestreams
	LiveStreams []*LiveStream

	HasMore bool
	// contains filtered or unexported fields
}

Feed allows you to fetch reccomended livestreams.

func (*Feed) Next

func (f *Feed) Next() (*FeedItem, error)

Next fetches the next couple of recommended live streams, if available. You can call this as long as Feed.HasMore = true. All items will be added

to the Feed.LiveStreams list.

type FeedItem

type FeedItem struct {
	LiveStreams []*LiveStream `json:"data"`
	Extra       struct {
		Banner struct {
			Banners     []interface{} `json:"banners"`
			BannersType int           `json:"banners_type"`
			SwitchType  int           `json:"switch_type"`
			Title       string        `json:"title"`
			Total       int           `json:"total"`
		} `json:"banner"`
		Cost        int    `json:"cost"`
		HasMore     bool   `json:"has_more"`
		HashtagText string `json:"hashtag_text"`
		IsBackup    int    `json:"is_backup"`
		LogPb       struct {
			ImprID    string `json:"impr_id"`
			SessionID int    `json:"session_id"`
		} `json:"log_pb"`
		MaxTime     int64  `json:"max_time"`
		MinTime     int    `json:"min_time"`
		Now         int64  `json:"now"`
		Style       int    `json:"style"`
		Total       int    `json:"total"`
		UnreadExtra string `json:"unread_extra"`
	} `json:"extra"`
	StatusCode int `json:"status_code"`
}

type GiftEvent

type GiftEvent struct {
	ID          int64
	Name        string
	Describe    string
	Cost        int
	RepeatCount int
	RepeatEnd   bool
	Type        int
	ToUserID    int64
	Timestamp   int64
	User        *User
}

type GiftInfo

type GiftInfo struct {
	DoodleTemplates []interface{} `json:"doodle_templates"`
	Gifts           []struct {
		ActionType            int           `json:"action_type"`
		AppID                 int           `json:"app_id"`
		BusinessText          string        `json:"business_text"`
		ColorInfos            []interface{} `json:"color_infos"`
		Combo                 bool          `json:"combo"`
		Describe              string        `json:"describe"`
		DiamondCount          int           `json:"diamond_count"`
		Duration              int           `json:"duration"`
		EventName             string        `json:"event_name"`
		ForCustom             bool          `json:"for_custom"`
		ForLinkmic            bool          `json:"for_linkmic"`
		GiftRankRecommendInfo string        `json:"gift_rank_recommend_info"`
		GiftScene             int           `json:"gift_scene"`
		GoldEffect            string        `json:"gold_effect"`
		GraySchemeURL         string        `json:"gray_scheme_url"`
		GuideURL              string        `json:"guide_url"`
		Icon                  struct {
			AvgColor   string   `json:"avg_color"`
			Height     int      `json:"height"`
			ImageType  int      `json:"image_type"`
			IsAnimated bool     `json:"is_animated"`
			OpenWebURL string   `json:"open_web_url"`
			URI        string   `json:"uri"`
			URLList    []string `json:"url_list"`
			Width      int      `json:"width"`
		} `json:"icon"`
		ID    int `json:"id"`
		Image struct {
			AvgColor   string   `json:"avg_color"`
			Height     int      `json:"height"`
			ImageType  int      `json:"image_type"`
			IsAnimated bool     `json:"is_animated"`
			OpenWebURL string   `json:"open_web_url"`
			URI        string   `json:"uri"`
			URLList    []string `json:"url_list"`
			Width      int      `json:"width"`
		} `json:"image"`
		IsBroadcastGift    bool `json:"is_broadcast_gift"`
		IsDisplayedOnPanel bool `json:"is_displayed_on_panel"`
		IsEffectBefview    bool `json:"is_effect_befview"`
		IsGray             bool `json:"is_gray"`
		IsRandomGift       bool `json:"is_random_gift"`
		ItemType           int  `json:"item_type"`
		LockInfo           struct {
			Lock     bool `json:"lock"`
			LockType int  `json:"lock_type"`
		} `json:"lock_info"`
		Manual          string `json:"manual"`
		Name            string `json:"name"`
		Notify          bool   `json:"notify"`
		PrimaryEffectID int    `json:"primary_effect_id"`
		Region          string `json:"region"`
		SchemeURL       string `json:"scheme_url"`
		SpecialEffects  struct {
		} `json:"special_effects"`
		TriggerWords  []interface{} `json:"trigger_words"`
		Type          int           `json:"type"`
		GiftLabelIcon struct {
			AvgColor   string   `json:"avg_color"`
			Height     int      `json:"height"`
			ImageType  int      `json:"image_type"`
			IsAnimated bool     `json:"is_animated"`
			OpenWebURL string   `json:"open_web_url"`
			URI        string   `json:"uri"`
			URLList    []string `json:"url_list"`
			Width      int      `json:"width"`
		} `json:"gift_label_icon,omitempty"`
		PreviewImage struct {
			AvgColor   string   `json:"avg_color"`
			Height     int      `json:"height"`
			ImageType  int      `json:"image_type"`
			IsAnimated bool     `json:"is_animated"`
			OpenWebURL string   `json:"open_web_url"`
			URI        string   `json:"uri"`
			URLList    []string `json:"url_list"`
			Width      int      `json:"width"`
		} `json:"preview_image,omitempty"`
		TrackerParams struct {
			GiftProperty string `json:"gift_property"`
		} `json:"tracker_params,omitempty"`
		GiftPanelBanner struct {
			BgColorValues []interface{} `json:"bg_color_values"`
			DisplayText   struct {
				DefaultFormat struct {
					Bold               bool   `json:"bold"`
					Color              string `json:"color"`
					FontSize           int    `json:"font_size"`
					Italic             bool   `json:"italic"`
					ItalicAngle        int    `json:"italic_angle"`
					UseHeighLightColor bool   `json:"use_heigh_light_color"`
					UseRemoteClor      bool   `json:"use_remote_clor"`
					Weight             int    `json:"weight"`
				} `json:"default_format"`
				DefaultPattern string        `json:"default_pattern"`
				Key            string        `json:"key"`
				Pieces         []interface{} `json:"pieces"`
			} `json:"display_text"`
			LeftIcon struct {
				AvgColor   string   `json:"avg_color"`
				Height     int      `json:"height"`
				ImageType  int      `json:"image_type"`
				IsAnimated bool     `json:"is_animated"`
				OpenWebURL string   `json:"open_web_url"`
				URI        string   `json:"uri"`
				URLList    []string `json:"url_list"`
				Width      int      `json:"width"`
			} `json:"left_icon"`
			SchemaURL string `json:"schema_url"`
		} `json:"gift_panel_banner,omitempty"`
	} `json:"gifts"`
	GiftsInfo struct {
		ColorGiftIconAnimation struct {
			AvgColor   string   `json:"avg_color"`
			Height     int      `json:"height"`
			ImageType  int      `json:"image_type"`
			IsAnimated bool     `json:"is_animated"`
			OpenWebURL string   `json:"open_web_url"`
			URI        string   `json:"uri"`
			URLList    []string `json:"url_list"`
			Width      int      `json:"width"`
		} `json:"color_gift_icon_animation"`
		DefaultLocColorGiftID            int  `json:"default_loc_color_gift_id"`
		EnableFirstRechargeDynamicEffect bool `json:"enable_first_recharge_dynamic_effect"`
		FirstRechargeGiftInfo            struct {
			ExpireAt             int `json:"expire_at"`
			GiftID               int `json:"gift_id"`
			OriginalDiamondCount int `json:"original_diamond_count"`
		} `json:"first_recharge_gift_info"`
		GiftComboInfos []interface{} `json:"gift_combo_infos"`
		GiftGroupInfos []struct {
			GroupCount int    `json:"group_count"`
			GroupText  string `json:"group_text"`
		} `json:"gift_group_infos"`
		GiftIconInfo struct {
			EffectURI string `json:"effect_uri"`
			Icon      struct {
				AvgColor   string        `json:"avg_color"`
				Height     int           `json:"height"`
				ImageType  int           `json:"image_type"`
				IsAnimated bool          `json:"is_animated"`
				OpenWebURL string        `json:"open_web_url"`
				URI        string        `json:"uri"`
				URLList    []interface{} `json:"url_list"`
				Width      int           `json:"width"`
			} `json:"icon"`
			IconID       int    `json:"icon_id"`
			IconURI      string `json:"icon_uri"`
			Name         string `json:"name"`
			ValidEndAt   int    `json:"valid_end_at"`
			ValidStartAt int    `json:"valid_start_at"`
			WithEffect   bool   `json:"with_effect"`
		} `json:"gift_icon_info"`
		GiftPollInfo struct {
			GiftPollOptions []struct {
				GiftID         int `json:"gift_id"`
				PollResultIcon struct {
					AvgColor   string   `json:"avg_color"`
					Height     int      `json:"height"`
					ImageType  int      `json:"image_type"`
					IsAnimated bool     `json:"is_animated"`
					OpenWebURL string   `json:"open_web_url"`
					URI        string   `json:"uri"`
					URLList    []string `json:"url_list"`
					Width      int      `json:"width"`
				} `json:"poll_result_icon"`
			} `json:"gift_poll_options"`
		} `json:"gift_poll_info"`
		GiftWords                 string `json:"gift_words"`
		HideRechargeEntry         bool   `json:"hide_recharge_entry"`
		NewGiftID                 int    `json:"new_gift_id"`
		RecentlySentColorGiftID   int    `json:"recently_sent_color_gift_id"`
		RecommendedRandomGiftID   int    `json:"recommended_random_gift_id"`
		ShowFirstRechargeEntrance bool   `json:"show_first_recharge_entrance"`
		SpeedyGiftID              int    `json:"speedy_gift_id"`
	} `json:"gifts_info"`
	Pages []interface{} `json:"pages"`
}

type IntroEvent

type IntroEvent struct {
	ID    int
	Title string
	User  *User
}

type LikeEvent

type LikeEvent struct {
	Likes       int
	TotalLikes  int
	User        *User
	DisplayType string
	Label       string
}

type Live

type Live struct {
	ID       string
	Info     *RoomInfo
	GiftInfo *GiftInfo
	Events   chan interface{}
	// contains filtered or unexported fields
}

Live allows you to track a livestream. To track a user call tiktok.TrackUser(<user>).

func (*Live) Close

func (l *Live) Close()

Close will terminate the connection and stop any downloads.

func (*Live) DownloadStream

func (l *Live) DownloadStream(file ...string) error

DownloadStream will download the stream to an .mkv file.

A filename can be optionally provided as an argument, if not provided one

will be generated, with the stream start time in the format of 2022y05m25dT13h03m16s.

The stream start time can be found in Live.Info.CreateTime as epoch seconds.

type LiveStream

type LiveStream struct {
	Room      *RoomInfo `json:"data"`
	DebugInfo string    `json:"debug_info"`
	FlareInfo struct {
		IsFlare bool   `json:"is_flare"`
		TaskID  string `json:"task_id"`
	} `json:"flare_info"`
	IsPseudoLiving  bool   `json:"is_pseudo_living"`
	IsRecommendCard bool   `json:"is_recommend_card"`
	LiveReason      string `json:"live_reason"`
	Rid             string `json:"rid"`
	Type            int    `json:"type"`
	// contains filtered or unexported fields
}

func (*LiveStream) Track

func (s *LiveStream) Track() (*Live, error)

Track stars tracking the livestream obtained from the Feed, and returns

a Live instance, just as if you would start tracking the user with
tiktok.TrackUser(<user>).

type MicBattleEvent

type MicBattleEvent struct {
	Users []*User
}

type PriceItem

type PriceItem struct {
	CouponID      string `json:"coupon_id"`
	CurrencyPrice []struct {
		Currency      string `json:"currency"`
		KeepDot       int    `json:"keep_dot"`
		OriginalPrice int    `json:"original_price"`
		Price         int    `json:"price"` // Local Currency Price Cents
		PriceDot      int    `json:"price_dot"`
		PriceShowForm string `json:"price_show_form"`
	} `json:"currency_price"`
	Describe      string `json:"describe"`
	DiamondCount  int    `json:"diamond_count"` // Coin Count
	DiscountPrice int    `json:"discount_price"`
	ExchangePrice int    `json:"exchange_price"` // Local Currency Price Cents
	GivingCount   int    `json:"giving_count"`
	IapID         string `json:"iap_id"`
	ID            int    `json:"id"`
	Price         int    `json:"price"` // USD Cents
}

type PriceList

type PriceList struct {
	PriceList []*PriceItem `json:"data"`
	Extra     struct {
		ApplePayHintURL                    string        `json:"apple_pay_hint_url"`
		BadgeIcon                          string        `json:"badge_icon"`
		Channel                            string        `json:"channel"`
		ChannelID                          int           `json:"channel_id"`
		CurrencyList                       []string      `json:"currency_list"`
		CustomizedIds                      []int         `json:"customized_ids"`
		DefaultCurrency                    string        `json:"default_currency"`
		DefaultPacketID                    int           `json:"default_packet_id"`
		ExtraDiamondList                   []interface{} `json:"extra_diamond_list"`
		FirstChargePacketID                int           `json:"first_charge_packet_id"`
		IsDefault                          bool          `json:"is_default"`
		IsRecommend                        bool          `json:"is_recommend"`
		LargePayURL                        string        `json:"large_pay_url"`
		MaxCustomizedDiamondCnt            int           `json:"max_customized_diamond_cnt"`
		MerchantID                         string        `json:"merchant_id"`
		MinCustomizedDiamondCnt            int           `json:"min_customized_diamond_cnt"`
		NeedAuth                           int           `json:"need_auth"`
		Now                                int64         `json:"now"`
		PloyTraceID                        int           `json:"ploy_trace_id"`
		RecentlyPurchasedPacketID          int           `json:"recently_purchased_packet_id"`
		RecommendedPacketID                int           `json:"recommended_packet_id"`
		ShouldDisplayCustomizedWebRecharge bool          `json:"should_display_customized_web_recharge"`
		ShowHint                           int           `json:"show_hint"`
		SignInfos                          []interface{} `json:"sign_infos"`
		TotalSigned                        int           `json:"total_signed"`
	} `json:"extra"`
	StatusCode int `json:"status_code"`
}

type ProfilePicture

type ProfilePicture struct {
	Urls []string
}

type QuestionEvent

type QuestionEvent struct {
	Quesion   string
	User      *User
	Timestamp int64
}

type RankList

type RankList struct {
	AnchorShowContribution bool        `json:"anchor_show_contribution"`
	Anonymous              int         `json:"anonymous"`
	Currency               string      `json:"currency"`
	Ranks                  []*RankUser `json:"ranks"`
	RuleURL                string      `json:"rule_url"`
	Total                  int         `json:"total"`
}

type RankUser

type RankUser struct {
	GapDescription       string    `json:"gap_description"`
	Rank                 int       `json:"rank"`  // Absolute Rank
	Score                int       `json:"score"` // Coins Count
	User                 *UserData `json:"user"`
	UserRestrictionLevel int       `json:"user_restriction_level"`
}

type RoomBannerEvent

type RoomBannerEvent struct {
	Data interface{}
}

type RoomEvent

type RoomEvent struct {
	Type    string
	Message string
}

type RoomInfo

type RoomInfo struct {
	AnchorABMap              interface{}   `json:"AnchorABMap"`
	AdminUserIds             []interface{} `json:"admin_user_ids"`
	AnchorScheduledTimeText  string        `json:"anchor_scheduled_time_text"`
	AnchorShareText          string        `json:"anchor_share_text"`
	AnchorTabType            float64       `json:"anchor_tab_type"`
	AnsweringQuestionContent string        `json:"answering_question_content"`
	AppID                    float64       `json:"app_id"`
	AutoCover                float64       `json:"auto_cover"`
	BookEndTime              float64       `json:"book_end_time"`
	BookTime                 float64       `json:"book_time"`
	BusinessLive             float64       `json:"business_live"`
	ChallengeInfo            string        `json:"challenge_info"`
	ClientVersion            float64       `json:"client_version"`
	CommentNameMode          float64       `json:"comment_name_mode"`
	CommerceInfo             struct {
		CommercePermission       float64 `json:"commerce_permission"`
		OecLiveEnterRoomInitData string  `json:"oec_live_enter_room_init_data"`
	} `json:"commerce_info"`
	CommonLabelList string `json:"common_label_list"`
	ContentTag      string `json:"content_tag"`
	Cover           struct {
		AvgColor   string   `json:"avg_color"`
		Height     float64  `json:"height"`
		ImageType  float64  `json:"image_type"`
		IsAnimated bool     `json:"is_animated"`
		OpenWebURL string   `json:"open_web_url"`
		URI        string   `json:"uri"`
		URLList    []string `json:"url_list"`
		Width      float64  `json:"width"`
	} `json:"cover"`
	CreateTime           int64         `json:"create_time"`
	DecoList             []interface{} `json:"deco_list"`
	DisablePreloadStream bool          `json:"disable_preload_stream"`
	FansclubMsgStyle     float64       `json:"fansclub_msg_style"`
	FeedRoomLabel        struct {
		AvgColor   string   `json:"avg_color"`
		Height     float64  `json:"height"`
		ImageType  float64  `json:"image_type"`
		IsAnimated bool     `json:"is_animated"`
		OpenWebURL string   `json:"open_web_url"`
		URI        string   `json:"uri"`
		URLList    []string `json:"url_list"`
		Width      float64  `json:"width"`
	} `json:"feed_room_label"`
	FeedRoomLabels      []interface{} `json:"feed_room_labels"`
	FilterMsgRules      []interface{} `json:"filter_msg_rules"`
	FinishReason        float64       `json:"finish_reason"`
	FinishTime          float64       `json:"finish_time"`
	FinishURL           string        `json:"finish_url"`
	FinishURLV2         string        `json:"finish_url_v2"`
	FollowMsgStyle      float64       `json:"follow_msg_style"`
	ForumExtraData      string        `json:"forum_extra_data"`
	GameTag             []interface{} `json:"game_tag"`
	GiftMsgStyle        float64       `json:"gift_msg_style"`
	GiftPollVoteEnabled bool          `json:"gift_poll_vote_enabled"`
	GroupSource         float64       `json:"group_source"`
	HasCommerceGoods    bool          `json:"has_commerce_goods"`
	Hashtag             struct {
		ID    float64 `json:"id"`
		Image struct {
			AvgColor   string   `json:"avg_color"`
			Height     float64  `json:"height"`
			ImageType  float64  `json:"image_type"`
			IsAnimated bool     `json:"is_animated"`
			OpenWebURL string   `json:"open_web_url"`
			URI        string   `json:"uri"`
			URLList    []string `json:"url_list"`
			Width      float64  `json:"width"`
		} `json:"image"`
		Namespace float64 `json:"namespace"`
		Title     string  `json:"title"`
	} `json:"hashtag"`
	HaveWishlist               bool    `json:"have_wishlist"`
	HotSentenceInfo            string  `json:"hot_sentence_info"`
	ID                         int64   `json:"id"`
	IDStr                      string  `json:"id_str"`
	InteractionQuestionVersion float64 `json:"interaction_question_version"`
	Introduction               string  `json:"introduction"`
	IsGatedRoom                bool    `json:"is_gated_room"`
	IsReplay                   bool    `json:"is_replay"`
	IsShowUserCardSwitch       bool    `json:"is_show_user_card_switch"`
	LastPingTime               float64 `json:"last_ping_time"`
	Layout                     float64 `json:"layout"`
	LikeCount                  float64 `json:"like_count"`
	LinkMic                    struct {
		AudienceIDList []interface{} `json:"audience_id_list"`
		BattleScores   []interface{} `json:"battle_scores"`
		BattleSettings struct {
			BattleID    float64 `json:"battle_id"`
			ChannelID   float64 `json:"channel_id"`
			Duration    float64 `json:"duration"`
			Finished    float64 `json:"finished"`
			MatchType   float64 `json:"match_type"`
			StartTime   float64 `json:"start_time"`
			StartTimeMs float64 `json:"start_time_ms"`
			Theme       string  `json:"theme"`
		} `json:"battle_settings"`
		ChannelID      float64       `json:"channel_id"`
		FollowedCount  float64       `json:"followed_count"`
		LinkedUserList []interface{} `json:"linked_user_list"`
		MultiLiveEnum  float64       `json:"multi_live_enum"`
		RivalAnchorID  float64       `json:"rival_anchor_id"`
		ShowUserList   []interface{} `json:"show_user_list"`
	} `json:"link_mic"`
	LinkerMap struct {
	} `json:"linker_map"`
	LinkmicLayout      float64       `json:"linkmic_layout"`
	LiveDistribution   []interface{} `json:"live_distribution"`
	LiveID             float64       `json:"live_id"`
	LiveReason         string        `json:"live_reason"`
	LiveRoomMode       float64       `json:"live_room_mode"`
	LiveTypeAudio      bool          `json:"live_type_audio"`
	LiveTypeLinkmic    bool          `json:"live_type_linkmic"`
	LiveTypeNormal     bool          `json:"live_type_normal"`
	LiveTypeSandbox    bool          `json:"live_type_sandbox"`
	LiveTypeScreenshot bool          `json:"live_type_screenshot"`
	LiveTypeSocialLive bool          `json:"live_type_social_live"`
	LiveTypeThirdParty bool          `json:"live_type_third_party"`
	LivingRoomAttrs    struct {
		AdminFlag   float64 `json:"admin_flag"`
		Rank        float64 `json:"rank"`
		RoomID      int64   `json:"room_id"`
		RoomIDStr   string  `json:"room_id_str"`
		SilenceFlag float64 `json:"silence_flag"`
	} `json:"living_room_attrs"`
	LotteryFinishTime    float64   `json:"lottery_finish_time"`
	MosaicStatus         float64   `json:"mosaic_status"`
	OsType               float64   `json:"os_type"`
	Owner                *UserData `json:"owner"`
	OwnerDeviceID        float64   `json:"owner_device_id"`
	OwnerDeviceIDStr     string    `json:"owner_device_id_str"`
	OwnerUserID          float64   `json:"owner_user_id"`
	OwnerUserIDStr       string    `json:"owner_user_id_str"`
	PreEnterTime         float64   `json:"pre_enter_time"`
	PreviewFlowTag       float64   `json:"preview_flow_tag"`
	RanklistAudienceType float64   `json:"ranklist_audience_type"`
	RelationTag          string    `json:"relation_tag"`
	Replay               bool      `json:"replay"`
	RoomAuditStatus      float64   `json:"room_audit_status"`
	RoomAuth             struct {
		Banner              float64 `json:"Banner"`
		BroadcastMessage    float64 `json:"BroadcastMessage"`
		Chat                bool    `json:"Chat"`
		ChatL2              bool    `json:"ChatL2"`
		ChatSubOnly         bool    `json:"ChatSubOnly"`
		Danmaku             bool    `json:"Danmaku"`
		Digg                bool    `json:"Digg"`
		DonationSticker     float64 `json:"DonationSticker"`
		Gift                bool    `json:"Gift"`
		GiftAnchorMt        float64 `json:"GiftAnchorMt"`
		GiftPoll            float64 `json:"GiftPoll"`
		GoldenEnvelope      float64 `json:"GoldenEnvelope"`
		InteractionQuestion bool    `json:"InteractionQuestion"`
		Landscape           float64 `json:"Landscape"`
		LandscapeChat       float64 `json:"LandscapeChat"`
		LuckMoney           bool    `json:"LuckMoney"`
		Poll                float64 `json:"Poll"`
		Promote             bool    `json:"Promote"`
		Props               bool    `json:"Props"`
		PublicScreen        float64 `json:"PublicScreen"`
		QuickChat           float64 `json:"QuickChat"`
		Rank                float64 `json:"Rank"`
		RoomContributor     bool    `json:"RoomContributor"`
		Share               bool    `json:"Share"`
		ShareEffect         float64 `json:"ShareEffect"`
		UserCard            bool    `json:"UserCard"`
		UserCount           float64 `json:"UserCount"`
		Viewers             bool    `json:"Viewers"`
		TransactionHistory  float64 `json:"transaction_history"`
	} `json:"room_auth"`
	RoomCreateAbParam string        `json:"room_create_ab_param"`
	RoomLayout        float64       `json:"room_layout"`
	RoomStickerList   []interface{} `json:"room_sticker_list"`
	RoomTabs          []interface{} `json:"room_tabs"`
	RoomTag           float64       `json:"room_tag"`
	ScrollConfig      string        `json:"scroll_config"`
	SearchID          float64       `json:"search_id"`
	ShareMsgStyle     float64       `json:"share_msg_style"`
	ShareURL          string        `json:"share_url"`
	ShortTitle        string        `json:"short_title"`
	ShortTouchItems   []interface{} `json:"short_touch_items"`
	SocialInteraction struct {
		MultiLive struct {
			UserSettings struct {
				MultiLiveApplyPermission float64 `json:"multi_live_apply_permission"`
			} `json:"user_settings"`
		} `json:"multi_live"`
	} `json:"social_interaction"`
	StartTime float64 `json:"start_time"`
	Stats     struct {
		DiggCount            float64 `json:"digg_count"`
		EnterCount           float64 `json:"enter_count"`
		FanTicket            float64 `json:"fan_ticket"`
		FollowCount          float64 `json:"follow_count"`
		GiftUvCount          float64 `json:"gift_uv_count"`
		ID                   int64   `json:"id"`
		IDStr                string  `json:"id_str"`
		LikeCount            float64 `json:"like_count"`
		ReplayFanTicket      float64 `json:"replay_fan_ticket"`
		ReplayViewers        float64 `json:"replay_viewers"`
		ShareCount           float64 `json:"share_count"`
		TotalUser            float64 `json:"total_user"`
		TotalUserDesp        string  `json:"total_user_desp"`
		UserCountComposition struct {
			MyFollow    float64 `json:"my_follow"`
			Other       float64 `json:"other"`
			VideoDetail float64 `json:"video_detail"`
		} `json:"user_count_composition"`
		Watermelon float64 `json:"watermelon"`
	} `json:"stats"`
	Status      float64       `json:"status"`
	StickerList []interface{} `json:"sticker_list"`
	StreamID    int64         `json:"stream_id"`
	StreamIDStr string        `json:"stream_id_str"`
	StreamURL   struct {
		CandidateResolution []string      `json:"candidate_resolution"`
		CompletePushUrls    []interface{} `json:"complete_push_urls"`
		DefaultResolution   string        `json:"default_resolution"`
		Extra               struct {
			AnchorInteractProfile   float64 `json:"anchor_interact_profile"`
			AudienceInteractProfile float64 `json:"audience_interact_profile"`
			BframeEnable            bool    `json:"bframe_enable"`
			BitrateAdaptStrategy    float64 `json:"bitrate_adapt_strategy"`
			Bytevc1Enable           bool    `json:"bytevc1_enable"`
			DefaultBitrate          float64 `json:"default_bitrate"`
			Fps                     float64 `json:"fps"`
			GopSec                  float64 `json:"gop_sec"`
			HardwareEncode          bool    `json:"hardware_encode"`
			Height                  float64 `json:"height"`
			MaxBitrate              float64 `json:"max_bitrate"`
			MinBitrate              float64 `json:"min_bitrate"`
			Roi                     bool    `json:"roi"`
			SwRoi                   bool    `json:"sw_roi"`
			VideoProfile            float64 `json:"video_profile"`
			Width                   float64 `json:"width"`
		} `json:"extra"`
		FlvPullURL struct {
			FullHd1 string `json:"FULL_HD1"`
			Hd1     string `json:"HD1"`
			Sd1     string `json:"SD1"`
			Sd2     string `json:"SD2"`
		} `json:"flv_pull_url"`
		FlvPullURLParams struct {
			FullHd1 string `json:"FULL_HD1"`
			Hd1     string `json:"HD1"`
			Sd1     string `json:"SD1"`
			Sd2     string `json:"SD2"`
		} `json:"flv_pull_url_params"`
		HlsPullURL    string `json:"hls_pull_url"`
		HlsPullURLMap struct {
		} `json:"hls_pull_url_map"`
		HlsPullURLParams string `json:"hls_pull_url_params"`
		ID               int64  `json:"id"`
		IDStr            string `json:"id_str"`
		LiveCoreSdkData  struct {
			PullData struct {
				Options struct {
					DefaultQuality struct {
						Level      float64 `json:"level"`
						Name       string  `json:"name"`
						Resolution string  `json:"resolution"`
						SdkKey     string  `json:"sdk_key"`
						VCodec     string  `json:"v_codec"`
					} `json:"default_quality"`
					Qualities []struct {
						Level      float64 `json:"level"`
						Name       string  `json:"name"`
						Resolution string  `json:"resolution"`
						SdkKey     string  `json:"sdk_key"`
						VCodec     string  `json:"v_codec"`
					} `json:"qualities"`
				} `json:"options"`
				StreamData string `json:"stream_data"`
			} `json:"pull_data"`
		} `json:"live_core_sdk_data"`
		Provider       float64       `json:"provider"`
		PushUrls       []interface{} `json:"push_urls"`
		ResolutionName struct {
			Auto    string `json:"AUTO"`
			FullHd1 string `json:"FULL_HD1"`
			Hd1     string `json:"HD1"`
			Origion string `json:"ORIGION"`
			Sd1     string `json:"SD1"`
			Sd2     string `json:"SD2"`
		} `json:"resolution_name"`
		RtmpPullURL       string  `json:"rtmp_pull_url"`
		RtmpPullURLParams string  `json:"rtmp_pull_url_params"`
		RtmpPushURL       string  `json:"rtmp_push_url"`
		RtmpPushURLParams string  `json:"rtmp_push_url_params"`
		StreamControlType float64 `json:"stream_control_type"`
	} `json:"stream_url"`
	StreamURLFilteredInfo struct {
		IsGatedRoom bool `json:"is_gated_room"`
		IsPaidEvent bool `json:"is_paid_event"`
	} `json:"stream_url_filtered_info"`
	Title             string    `json:"title"`
	TopFans           []*TopFan `json:"top_fans"`
	UseFilter         bool      `json:"use_filter"`
	UserCount         int       `json:"user_count"` // Viewers
	UserShareText     string    `json:"user_share_text"`
	VideoFeedTag      string    `json:"video_feed_tag"`
	WebcastCommentTcs float64   `json:"webcast_comment_tcs"`
	WebcastSdkVersion float64   `json:"webcast_sdk_version"`
	WithDrawSomething bool      `json:"with_draw_something"`
	WithKtv           bool      `json:"with_ktv"`
	WithLinkmic       bool      `json:"with_linkmic"`
}

type SignedURL

type SignedURL struct {
	SignedURL      string `json:"signedUrl"`
	MsToken        string `json:"msToken"`
	Signature      string `json:"_signature"`
	XBogus         string `json:"X-Bogus"`
	UserAgent      string `json:"User-Agent"`
	BrowserVersion string `json:"browserVersion"`
	BrowserName    string `json:"browserName"`
	Error          string `json:"error"`
}

type TikTok

type TikTok struct {

	// Pass extra debug messages to debugHandler
	Debug bool

	// LogRequests when set to true will log all made requests in JSON to debugHandler
	LogRequests bool
	// contains filtered or unexported fields
}

TikTok allows you to track and discover current live streams.

func NewTikTok

func NewTikTok() *TikTok

NewTikTok creates a tiktok instance that allows you to track live streams and

discover current livestreams.

func (*TikTok) GetPriceList

func (t *TikTok) GetPriceList() (*PriceList, error)

GetPriceList fetches the price list of tiktok coins. Prices will be given in

USD cents and the cents equivalent of the local currency of the IP location.

To fetch a different currency, use a VPN or proxy to change your IP to a

different country.

func (*TikTok) GetRoomInfo

func (t *TikTok) GetRoomInfo(username string) (*RoomInfo, error)

GetRoomInfo will only fetch the room info, normally available with live.Info

but not start tracking a live stream.

func (*TikTok) GetUserInfo

func (t *TikTok) GetUserInfo(user string) (*UserInfo, error)

GetUserInfo will fetch information about the user, such as follwers stats,

their user ID, as well as the RoomID, with which you can tell if they are live.

func (*TikTok) NewFeed

func (t *TikTok) NewFeed() *Feed

NewFeed creates a new Feed instance. Start fetching reccomended livestreams

with Feed.Next().

func (*TikTok) SetDebugHandler

func (t *TikTok) SetDebugHandler(f func(...interface{}))

func (*TikTok) SetErrorHandler

func (t *TikTok) SetErrorHandler(f func(...interface{}))

func (*TikTok) SetInfoHandler

func (t *TikTok) SetInfoHandler(f func(...interface{}))

func (*TikTok) SetProxy

func (t *TikTok) SetProxy(url string, insecure bool) error

SetProxy will set a proxy for both the http client as well as the websocket. You can manually set a proxy with this method, or by using the HTTPS_PROXY

environment variable.

ALL_PROXY can be used to set a proxy only for the websocket.

func (*TikTok) SetWarnHandler

func (t *TikTok) SetWarnHandler(f func(...interface{}))

func (*TikTok) TrackRoom

func (t *TikTok) TrackRoom(roomId string) (*Live, error)

TrackRoom will start to track a room by room ID. It will start a go routine and connect to the tiktok websocket.

func (*TikTok) TrackUser

func (t *TikTok) TrackUser(username string) (*Live, error)

TrackUser will start to track the livestream of a user, if live. To listen to events emitted by the livestream, such as comments and viewer

count, listen to the Live.Events channel.

It will start a go routine and connect to the tiktok websocket.

type TopFan

type TopFan struct {
	FanTicket float64   `json:"fan_ticket"`
	User      *UserData `json:"user"`
}

type User

type User struct {
	ID              int64
	Username        string
	Nickname        string
	ProfilePicture  *ProfilePicture
	ExtraAttributes *ExtraAttributes
	Badge           *BadgeAttributes
}

type UserBadge

type UserBadge struct {
	Type string
	Name string
}

type UserData

type UserData struct {
	AllowFindByContacts                 bool `json:"allow_find_by_contacts"`
	AllowOthersDownloadVideo            bool `json:"allow_others_download_video"`
	AllowOthersDownloadWhenSharingVideo bool `json:"allow_others_download_when_sharing_video"`
	AllowShareShowProfile               bool `json:"allow_share_show_profile"`
	AllowShowInGossip                   bool `json:"allow_show_in_gossip"`
	AllowShowMyAction                   bool `json:"allow_show_my_action"`
	AllowStrangeComment                 bool `json:"allow_strange_comment"`
	AllowUnfollowerComment              bool `json:"allow_unfollower_comment"`
	AllowUseLinkmic                     bool `json:"allow_use_linkmic"`
	AvatarLarge                         struct {
		AvgColor   string   `json:"avg_color"`
		Height     int      `json:"height"`
		ImageType  int      `json:"image_type"`
		IsAnimated bool     `json:"is_animated"`
		OpenWebURL string   `json:"open_web_url"`
		URI        string   `json:"uri"`
		URLList    []string `json:"url_list"`
		Width      int      `json:"width"`
	} `json:"avatar_large"`
	AvatarMedium struct {
		AvgColor   string   `json:"avg_color"`
		Height     int      `json:"height"`
		ImageType  int      `json:"image_type"`
		IsAnimated bool     `json:"is_animated"`
		OpenWebURL string   `json:"open_web_url"`
		URI        string   `json:"uri"`
		URLList    []string `json:"url_list"`
		Width      int      `json:"width"`
	} `json:"avatar_medium"`
	AvatarThumb struct {
		AvgColor   string   `json:"avg_color"`
		Height     int      `json:"height"`
		ImageType  int      `json:"image_type"`
		IsAnimated bool     `json:"is_animated"`
		OpenWebURL string   `json:"open_web_url"`
		URI        string   `json:"uri"`
		URLList    []string `json:"url_list"`
		Width      int      `json:"width"`
	} `json:"avatar_thumb"`
	BadgeImageList           []interface{} `json:"badge_image_list"`
	BadgeList                []interface{} `json:"badge_list"`
	BgImgURL                 string        `json:"bg_img_url"`
	BioDescription           string        `json:"bio_description"`
	BlockStatus              int           `json:"block_status"`
	BorderList               []interface{} `json:"border_list"`
	CommentRestrict          int           `json:"comment_restrict"`
	CommerceWebcastConfigIds []interface{} `json:"commerce_webcast_config_ids"`
	Constellation            string        `json:"constellation"`
	CreateTime               int           `json:"create_time"`
	DisableIchat             int           `json:"disable_ichat"`
	Username                 string        `json:"display_id"`
	EnableIchatImg           int           `json:"enable_ichat_img"`
	Exp                      int           `json:"exp"`
	FanTicketCount           int           `json:"fan_ticket_count"`
	FoldStrangerChat         bool          `json:"fold_stranger_chat"`
	FollowInfo               struct {
		FollowStatus   int `json:"follow_status"`
		FollowerCount  int `json:"follower_count"`
		FollowingCount int `json:"following_count"`
		PushStatus     int `json:"push_status"`
	} `json:"follow_info"`
	FollowStatus        int           `json:"follow_status"`
	IchatRestrictType   int           `json:"ichat_restrict_type"`
	ID                  int64         `json:"id"`
	IDStr               string        `json:"id_str"`
	IsFollower          bool          `json:"is_follower"`
	IsFollowing         bool          `json:"is_following"`
	LinkMicStats        int           `json:"link_mic_stats"`
	MediaBadgeImageList []interface{} `json:"media_badge_image_list"`
	ModifyTime          int           `json:"modify_time"`
	NeedProfileGuide    bool          `json:"need_profile_guide"`
	NewRealTimeIcons    []interface{} `json:"new_real_time_icons"`
	Nickname            string        `json:"nickname"`
	OwnRoom             struct {
		RoomIds    []int64  `json:"room_ids"`
		RoomIdsStr []string `json:"room_ids_str"`
	} `json:"own_room"`
	PayGrade struct {
		GradeBanner        string        `json:"grade_banner"`
		GradeDescribe      string        `json:"grade_describe"`
		GradeIconList      []interface{} `json:"grade_icon_list"`
		Level              int           `json:"level"`
		Name               string        `json:"name"`
		NextName           string        `json:"next_name"`
		NextPrivileges     string        `json:"next_privileges"`
		Score              int           `json:"score"`
		ScreenChatType     int           `json:"screen_chat_type"`
		UpgradeNeedConsume int           `json:"upgrade_need_consume"`
	} `json:"pay_grade"`
	PayScore           int           `json:"pay_score"`
	PayScores          int           `json:"pay_scores"`
	PushCommentStatus  bool          `json:"push_comment_status"`
	PushDigg           bool          `json:"push_digg"`
	PushFollow         bool          `json:"push_follow"`
	PushFriendAction   bool          `json:"push_friend_action"`
	PushIchat          bool          `json:"push_ichat"`
	PushStatus         bool          `json:"push_status"`
	PushVideoPost      bool          `json:"push_video_post"`
	PushVideoRecommend bool          `json:"push_video_recommend"`
	RealTimeIcons      []interface{} `json:"real_time_icons"`
	SecUID             string        `json:"sec_uid"`
	Secret             int           `json:"secret"`
	ShareQrcodeURI     string        `json:"share_qrcode_uri"`
	SpecialID          string        `json:"special_id"`
	Status             int           `json:"status"`
	TicketCount        int           `json:"ticket_count"`
	TopFans            []interface{} `json:"top_fans"`
	TopVipNo           int           `json:"top_vip_no"`
	UserAttr           struct {
		IsAdmin      bool `json:"is_admin"`
		IsMuted      bool `json:"is_muted"`
		IsSuperAdmin bool `json:"is_super_admin"`
		MuteDuration int  `json:"mute_duration"`
	} `json:"user_attr"`
	UserRole                    int    `json:"user_role"`
	Verified                    bool   `json:"verified"`
	VerifiedContent             string `json:"verified_content"`
	VerifiedReason              string `json:"verified_reason"`
	WithCarManagementPermission bool   `json:"with_car_management_permission"`
	WithCommercePermission      bool   `json:"with_commerce_permission"`
	WithFusionShopEntry         bool   `json:"with_fusion_shop_entry"`
}

type UserEvent

type UserEvent struct {
	Event userEventType
	User  *User
}

type UserInfo

type UserInfo struct {
	ID           string `json:"id"`
	ShortID      string `json:"shortId"`
	UniqueID     string `json:"uniqueId"`
	Nickname     string `json:"nickname"`
	AvatarLarger string `json:"avatarLarger"`
	AvatarMedium string `json:"avatarMedium"`
	AvatarThumb  string `json:"avatarThumb"`
	Biography    string `json:"signature"`
	CreateTime   int    `json:"createTime"`
	Verified     bool   `json:"verified"`
	SecUID       string `json:"secUid"`
	Ftc          bool   `json:"ftc"`
	Relation     int    `json:"relation"`
	OpenFavorite bool   `json:"openFavorite"`
	BioLink      struct {
		Link string `json:"link"`
		Risk int    `json:"risk"`
	} `json:"bioLink"`
	CommentSetting int    `json:"commentSetting"`
	DuetSetting    int    `json:"duetSetting"`
	StitchSetting  int    `json:"stitchSetting"`
	PrivateAccount bool   `json:"privateAccount"`
	Secret         bool   `json:"secret"`
	IsADVirtual    bool   `json:"isADVirtual"`
	RoomID         string `json:"roomId"`

	Stats UserStats
}

type UserStats

type UserStats struct {
	FollowerCount  int  `json:"followerCount"`
	FollowingCount int  `json:"followingCount"`
	Heart          int  `json:"heart"`
	HeartCount     int  `json:"heartCount"`
	VideoCount     int  `json:"videoCount"`
	DiggCount      int  `json:"diggCount"`
	NeedFix        bool `json:"needFix"`
}

type ViewersEvent

type ViewersEvent struct {
	Viewers int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL