youtubehelper

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 9, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActiveLiveChatCollector

type ActiveLiveChatCollector struct {
	// contains filtered or unexported fields
}

func NewActiveLiveChatCollector

func NewActiveLiveChatCollector(apiKey string, opts ...Option) *ActiveLiveChatCollector

func (*ActiveLiveChatCollector) CreateParams

func (a *ActiveLiveChatCollector) CreateParams(video *youtube.Video) (*ActiveLiveChatParams, error)

func (*ActiveLiveChatCollector) CreateYoutubeService

func (a *ActiveLiveChatCollector) CreateYoutubeService() (*youtube.Service, error)

func (*ActiveLiveChatCollector) GetActiveLiveChat

func (a *ActiveLiveChatCollector) GetActiveLiveChat(params *ActiveLiveChatParams, youtubeService *youtube.Service, max int64) (*youtube.LiveChatMessageListResponse, error)

func (*ActiveLiveChatCollector) GetVideo

func (a *ActiveLiveChatCollector) GetVideo(videoId string, youtubeService *youtube.Service) (*youtube.Video, bool, error)

func (*ActiveLiveChatCollector) Next

func (a *ActiveLiveChatCollector) Next(params *ActiveLiveChatParams, liveChatMessageListResponse *youtube.LiveChatMessageListResponse) bool

type ActiveLiveChatParams

type ActiveLiveChatParams struct {
	// contains filtered or unexported fields
}

func (*ActiveLiveChatParams) GetPageToken

func (a *ActiveLiveChatParams) GetPageToken() string

type ArchiveLiveChatCollector

type ArchiveLiveChatCollector struct {
	// contains filtered or unexported fields
}

func NewArchiveLiveChatCollector

func NewArchiveLiveChatCollector(opts ...Option) *ArchiveLiveChatCollector

func (*ArchiveLiveChatCollector) GetArchiveLiveChat

func (a *ArchiveLiveChatCollector) GetArchiveLiveChat(params ArchiveLiveChatParams) (*GetLiveChatRespose, error)

func (*ArchiveLiveChatCollector) GetParams

func (*ArchiveLiveChatCollector) Next

type ArchiveLiveChatParams

type ArchiveLiveChatParams map[string]string

func (ArchiveLiveChatParams) GetContinuation

func (a ArchiveLiveChatParams) GetContinuation() string

type GetLiveChatRequest

type GetLiveChatRequest struct {
	Context struct {
		AdSignalsInfo struct {
			Params []struct {
				Key   string `json:"key"`
				Value string `json:"value"`
			} `json:"params,omitempty"`
		} `json:"adSignalsInfo"`
		Client struct {
			BrowserName      string `json:"browserName"`
			BrowserVersion   string `json:"browserVersion"`
			ClientFormFactor string `json:"clientFormFactor"`
			ClientName       string `json:"clientName"`
			ClientVersion    string `json:"clientVersion"`
			ConnectionType   string `json:"connectionType,omitempty"`
			DeviceMake       string `json:"deviceMake"`
			DeviceModel      string `json:"deviceModel"`
			Gl               string `json:"gl"`
			Hl               string `json:"hl"`
			MainAppWebInfo   struct {
				GraftURL       string `json:"graftUrl"`
				WebDisplayMode string `json:"webDisplayMode"`
			} `json:"mainAppWebInfo"`
			OriginalURL        string `json:"originalUrl"`
			OsName             string `json:"osName"`
			OsVersion          string `json:"osVersion"`
			Platform           string `json:"platform"`
			RemoteHost         string `json:"remoteHost"`
			ScreenDensityFloat int64  `json:"screenDensityFloat,omitempty"`
			ScreenHeightPoints int64  `json:"screenHeightPoints,omitempty"`
			ScreenPixelDensity int64  `json:"screenPixelDensity,omitempty"`
			ScreenWidthPoints  int64  `json:"screenWidthPoints,omitempty"`
			TimeZone           string `json:"timeZone"`
			UserAgent          string `json:"userAgent"`
			UserInterfaceTheme string `json:"userInterfaceTheme,omitempty"`
			UtcOffsetMinutes   int64  `json:"utcOffsetMinutes"`
			VisitorData        string `json:"visitorData"`
		} `json:"client"`
		ClientScreenNonce string `json:"clientScreenNonce,omitempty"`
		Request           struct {
			ConsistencyTokenJars    []interface{} `json:"consistencyTokenJars,omitempty"`
			InternalExperimentFlags []interface{} `json:"internalExperimentFlags,,omitempty"`
			UseSsl                  bool          `json:"useSsl"`
		} `json:"request"`
		User struct {
			LockedSafetyMode bool `json:"lockedSafetyMode"`
		} `json:"user"`
	} `json:"context"`
	Continuation       string `json:"continuation"`
	CurrentPlayerState struct {
		PlayerOffsetMs string `json:"playerOffsetMs"`
	} `json:"currentPlayerState"`
}

type GetLiveChatRespose

type GetLiveChatRespose struct {
	ContinuationContents struct {
		LiveChatContinuation struct {
			Actions []struct {
				ReplayChatItemAction struct {
					Actions []struct {
						AddChatItemAction struct {
							ClientID string `json:"clientId"`
							Item     struct {
								LiveChatPaidMessageRenderer struct {
									AuthorExternalChannelID string `json:"authorExternalChannelId"`
									AuthorName              struct {
										SimpleText string `json:"simpleText"`
									} `json:"authorName"`
									AuthorNameTextColor int64 `json:"authorNameTextColor"`
									AuthorPhoto         struct {
										Thumbnails []struct {
											Height int64  `json:"height"`
											URL    string `json:"url"`
											Width  int64  `json:"width"`
										} `json:"thumbnails"`
									} `json:"authorPhoto"`
									BodyBackgroundColor      int64 `json:"bodyBackgroundColor"`
									BodyTextColor            int64 `json:"bodyTextColor"`
									ContextMenuAccessibility struct {
										AccessibilityData struct {
											Label string `json:"label"`
										} `json:"accessibilityData"`
									} `json:"contextMenuAccessibility"`
									ContextMenuEndpoint struct {
										CommandMetadata struct {
											WebCommandMetadata struct {
												IgnoreNavigation bool `json:"ignoreNavigation"`
											} `json:"webCommandMetadata"`
										} `json:"commandMetadata"`
										LiveChatItemContextMenuEndpoint struct {
											Params string `json:"params"`
										} `json:"liveChatItemContextMenuEndpoint"`
									} `json:"contextMenuEndpoint"`
									HeaderBackgroundColor int64  `json:"headerBackgroundColor"`
									HeaderTextColor       int64  `json:"headerTextColor"`
									ID                    string `json:"id"`
									Message               struct {
										Runs []struct {
											Text string `json:"text"`
										} `json:"runs"`
									} `json:"message"`
									PurchaseAmountText struct {
										SimpleText string `json:"simpleText"`
									} `json:"purchaseAmountText"`
									TimestampColor int64 `json:"timestampColor"`
									TimestampText  struct {
										SimpleText string `json:"simpleText"`
									} `json:"timestampText"`
									TimestampUsec string `json:"timestampUsec"`
								} `json:"liveChatPaidMessageRenderer"`
								LiveChatTextMessageRenderer struct {
									AuthorBadges []struct {
										LiveChatAuthorBadgeRenderer struct {
											Accessibility struct {
												AccessibilityData struct {
													Label string `json:"label"`
												} `json:"accessibilityData"`
											} `json:"accessibility"`
											CustomThumbnail struct {
												Thumbnails []struct {
													URL string `json:"url"`
												} `json:"thumbnails"`
											} `json:"customThumbnail"`
											Tooltip string `json:"tooltip"`
										} `json:"liveChatAuthorBadgeRenderer"`
									} `json:"authorBadges"`
									AuthorExternalChannelID string `json:"authorExternalChannelId"`
									AuthorName              struct {
										SimpleText string `json:"simpleText"`
									} `json:"authorName"`
									AuthorPhoto struct {
										Thumbnails []struct {
											Height int64  `json:"height"`
											URL    string `json:"url"`
											Width  int64  `json:"width"`
										} `json:"thumbnails"`
									} `json:"authorPhoto"`
									ContextMenuAccessibility struct {
										AccessibilityData struct {
											Label string `json:"label"`
										} `json:"accessibilityData"`
									} `json:"contextMenuAccessibility"`
									ContextMenuEndpoint struct {
										CommandMetadata struct {
											WebCommandMetadata struct {
												IgnoreNavigation bool `json:"ignoreNavigation"`
											} `json:"webCommandMetadata"`
										} `json:"commandMetadata"`
										LiveChatItemContextMenuEndpoint struct {
											Params string `json:"params"`
										} `json:"liveChatItemContextMenuEndpoint"`
									} `json:"contextMenuEndpoint"`
									ID      string `json:"id"`
									Message struct {
										Runs []struct {
											Emoji struct {
												EmojiID string `json:"emojiId"`
												Image   struct {
													Accessibility struct {
														AccessibilityData struct {
															Label string `json:"label"`
														} `json:"accessibilityData"`
													} `json:"accessibility"`
													Thumbnails []struct {
														Height int64  `json:"height"`
														URL    string `json:"url"`
														Width  int64  `json:"width"`
													} `json:"thumbnails"`
												} `json:"image"`
												IsCustomEmoji bool     `json:"isCustomEmoji"`
												SearchTerms   []string `json:"searchTerms"`
												Shortcuts     []string `json:"shortcuts"`
											} `json:"emoji"`
											Text string `json:"text"`
										} `json:"runs"`
									} `json:"message"`
									TimestampText struct {
										SimpleText string `json:"simpleText"`
									} `json:"timestampText"`
									TimestampUsec string `json:"timestampUsec"`
								} `json:"liveChatTextMessageRenderer"`
							} `json:"item"`
						} `json:"addChatItemAction"`
						AddLiveChatTickerItemAction struct {
							DurationSec string `json:"durationSec"`
							Item        struct {
								LiveChatTickerPaidMessageItemRenderer struct {
									Amount struct {
										SimpleText string `json:"simpleText"`
									} `json:"amount"`
									AmountTextColor         int64  `json:"amountTextColor"`
									AuthorExternalChannelID string `json:"authorExternalChannelId"`
									AuthorPhoto             struct {
										Accessibility struct {
											AccessibilityData struct {
												Label string `json:"label"`
											} `json:"accessibilityData"`
										} `json:"accessibility"`
										Thumbnails []struct {
											Height int64  `json:"height"`
											URL    string `json:"url"`
											Width  int64  `json:"width"`
										} `json:"thumbnails"`
									} `json:"authorPhoto"`
									DurationSec        int64  `json:"durationSec"`
									EndBackgroundColor int64  `json:"endBackgroundColor"`
									FullDurationSec    int64  `json:"fullDurationSec"`
									ID                 string `json:"id"`
									ShowItemEndpoint   struct {
										CommandMetadata struct {
											WebCommandMetadata struct {
												IgnoreNavigation bool `json:"ignoreNavigation"`
											} `json:"webCommandMetadata"`
										} `json:"commandMetadata"`
										ShowLiveChatItemEndpoint struct {
											Renderer struct {
												LiveChatPaidMessageRenderer struct {
													AuthorExternalChannelID string `json:"authorExternalChannelId"`
													AuthorName              struct {
														SimpleText string `json:"simpleText"`
													} `json:"authorName"`
													AuthorNameTextColor int64 `json:"authorNameTextColor"`
													AuthorPhoto         struct {
														Thumbnails []struct {
															Height int64  `json:"height"`
															URL    string `json:"url"`
															Width  int64  `json:"width"`
														} `json:"thumbnails"`
													} `json:"authorPhoto"`
													BodyBackgroundColor      int64 `json:"bodyBackgroundColor"`
													BodyTextColor            int64 `json:"bodyTextColor"`
													ContextMenuAccessibility struct {
														AccessibilityData struct {
															Label string `json:"label"`
														} `json:"accessibilityData"`
													} `json:"contextMenuAccessibility"`
													ContextMenuEndpoint struct {
														CommandMetadata struct {
															WebCommandMetadata struct {
																IgnoreNavigation bool `json:"ignoreNavigation"`
															} `json:"webCommandMetadata"`
														} `json:"commandMetadata"`
														LiveChatItemContextMenuEndpoint struct {
															Params string `json:"params"`
														} `json:"liveChatItemContextMenuEndpoint"`
													} `json:"contextMenuEndpoint"`
													HeaderBackgroundColor int64  `json:"headerBackgroundColor"`
													HeaderTextColor       int64  `json:"headerTextColor"`
													ID                    string `json:"id"`
													Message               struct {
														Runs []struct {
															Text string `json:"text"`
														} `json:"runs"`
													} `json:"message"`
													PurchaseAmountText struct {
														SimpleText string `json:"simpleText"`
													} `json:"purchaseAmountText"`
													TimestampColor int64 `json:"timestampColor"`
													TimestampText  struct {
														SimpleText string `json:"simpleText"`
													} `json:"timestampText"`
													TimestampUsec string `json:"timestampUsec"`
												} `json:"liveChatPaidMessageRenderer"`
											} `json:"renderer"`
										} `json:"showLiveChatItemEndpoint"`
									} `json:"showItemEndpoint"`
									StartBackgroundColor int64 `json:"startBackgroundColor"`
								} `json:"liveChatTickerPaidMessageItemRenderer"`
							} `json:"item"`
						} `json:"addLiveChatTickerItemAction"`
					} `json:"actions"`
					VideoOffsetTimeMsec string `json:"videoOffsetTimeMsec"`
				} `json:"replayChatItemAction"`
			} `json:"actions"`
			Continuations []struct {
				LiveChatReplayContinuationData struct {
					Continuation             string `json:"continuation"`
					TimeUntilLastMessageMsec int64  `json:"timeUntilLastMessageMsec"`
				} `json:"liveChatReplayContinuationData"`
				PlayerSeekContinuationData struct {
					Continuation string `json:"continuation"`
				} `json:"playerSeekContinuationData"`
			} `json:"continuations"`
		} `json:"liveChatContinuation"`
	} `json:"continuationContents"`
	ResponseContext struct {
		MainAppWebResponseContext struct {
			DatasyncID string `json:"datasyncId"`
			LoggedOut  bool   `json:"loggedOut"`
		} `json:"mainAppWebResponseContext"`
		ServiceTrackingParams []struct {
			Params []struct {
				Key   string `json:"key"`
				Value string `json:"value"`
			} `json:"params"`
			Service string `json:"service"`
		} `json:"serviceTrackingParams"`
		WebResponseContextExtensionData struct {
			HasDecorated bool `json:"hasDecorated"`
		} `json:"webResponseContextExtensionData"`
	} `json:"responseContext"`
}

type Option

type Option func(*options)

func Verbose

func Verbose(verbose bool) Option

Jump to

Keyboard shortcuts

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