Documentation
¶
Index ¶
- Variables
- type BaseChannel
- type BaseVideo
- type Caption
- type CaptionLanguage
- type Channel
- type ChannelLive
- type ChannelPlaylists
- type ChannelPosts
- type ChannelShorts
- type ChannelVideos
- type Chapter
- type Client
- type Comment
- type CommentReplies
- type Continuable
- type LiveVideo
- type MusicMetadata
- type PlaylistCompact
- type Post
- type Reply
- type Video
- type VideoCaptions
- type VideoComments
- type VideoCompact
- type VideoRelated
- type VideoResult
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrCaptionsNotFound = errors.New("captions not found for the specified language")
View Source
var ErrChannelNotFound = errors.New("channel not found")
View Source
var ErrVideoNotFound = errors.New("video not found")
Functions ¶
This section is empty.
Types ¶
type BaseChannel ¶
type BaseChannel struct {
ID string `js:"id"`
// The channel's name
Name string `js:"name"`
// The channel's handle start with @
Handle string `js:"handle"`
// The channel's description
Description string `js:"description"`
// Thumbnails of this Channel
Thumbnails shared.Thumbnails `js:"thumbnails"`
// How many subscribers does this channel have.
//
// This is not the exact amount, but a literal string like `"1.95M subscribers"`
SubscriberCount string `js:"subscriberCount"`
// Continuable of videos
Videos ChannelVideos
// Continuable of shorts
Shorts ChannelShorts
// Continuable of live
Live ChannelLive
// Continuable of playlists
Playlists ChannelPlaylists
// Continuable of posts
Posts ChannelPosts
// The URL of the channel page
URL string `js:"url"`
}
func (*BaseChannel) FromObject ¶
type BaseVideo ¶
type BaseVideo struct {
ID string `js:"id"`
// The title of this video
Title string `js:"title"`
// Thumbnails of the video with different sizes
Thumbnails shared.Thumbnails `js:"thumbnails"`
// The description of this video
Description string `js:"description"`
// The channel that uploaded this video
Channel Option[BaseChannel]
// The collaborators of this video
Channels Option[[]BaseChannel]
// The date this video is uploaded at
UploadDate string `js:"uploadDate"`
// How many views does this video have, None if the view count is hidden
ViewCount Option[int64]
// How many likes does this video have, None if the like count is hidden
LikeCount Option[int64]
// Whether this video is a live content or not
IsLiveContent bool `js:"isLiveContent"`
// The tags of this video
Tags []string `js:"tags"`
// Continuable of videos / playlists related to this video
Related Continuable[VideoRelated] `js:"related"`
// Captions helper class of this video (if caption exists in this video)
Captions VideoCaptions
}
type CaptionLanguage ¶
type Channel ¶
type Channel struct {
BaseChannel
// How many videos does this channel have
VideoCount string `js:"videoCount"`
Banner shared.Thumbnails
MobileBanner shared.Thumbnails
TvBanner shared.Thumbnails
Shelves []shared.Shelf
}
type ChannelLive ¶
type ChannelLive = Continuable[VideoCompact]
type ChannelPlaylists ¶
type ChannelPlaylists = Continuable[PlaylistCompact]
type ChannelPosts ¶
type ChannelPosts = Continuable[Post]
type ChannelShorts ¶
type ChannelShorts = Continuable[VideoCompact]
type ChannelVideos ¶
type ChannelVideos = Continuable[VideoCompact]
type Chapter ¶
type Chapter struct {
Title string `js:"title"`
Start int64 `js:"start"`
Thumbnails shared.Thumbnails
}
type Comment ¶
type Comment struct {
ID string `js:"id"`
// The video this comment belongs to
Video Video
// The comment's author
Author BaseChannel
// The content of this comment
Content string `js:"content"`
// The publish date of the comment
PublishDate string `js:"publishDate"`
// How many likes does this comment have
LikeCount int64 `js:"likeCount"`
// Whether the comment is posted by the video uploader / owner
IsAuthorChannelOwner bool `js:"isAuthorChannelOwner"`
// Whether the comment is pinned
IsPinned bool `js:"isPinned"`
// Reply count of this comment
ReplyCount int64 `js:"replyCount"`
// Continuable of replies in this comment
Replies CommentReplies
// URL to the video with this comment being highlighted (appears on top of the comment section)
URL string `js:"url"`
}
type CommentReplies ¶
type CommentReplies = Continuable[Reply]
type Continuable ¶
type Continuable[T any] struct { // contains filtered or unexported fields }
func (*Continuable[T]) FromObject ¶
func (*Continuable[T]) Items ¶
func (x *Continuable[T]) Items() ([]T, error)
func (*Continuable[T]) Next ¶
func (x *Continuable[T]) Next(count int64) ([]T, error)
type MusicMetadata ¶ added in v0.4.0
type MusicMetadata struct {
ImageUrl string `js:"imageUrl"`
Title string `js:"title"`
Artist string `js:"artist"`
Album Option[string]
}
func (*MusicMetadata) FromObject ¶ added in v0.4.0
type PlaylistCompact ¶
type PlaylistCompact struct {
ID string `js:"id"`
// The playlist's title
Title string `js:"title"`
// Thumbnails of the playlist with different sizes
Thumbnails shared.Thumbnails
// The channel that made this playlist
Channel BaseChannel `js:"channel"`
// How many videos in this playlist
VideoCount int64 `js:"videoCount"`
}
func (*PlaylistCompact) FromObject ¶
type Post ¶
type Post struct {
ID string `js:"id"`
// The channel who posted this post
Channel BaseChannel
// The content of this post
Content string `js:"content"`
// Timestamp
Timestamp string `js:"timestamp"`
// Vote count like '1.2K likes'
VoteCount string `js:"voteCount"`
}
type Reply ¶
type Reply struct {
ID string `js:"id"`
// The comment this reply belongs to
Comment Comment
// The video this reply belongs to
Video Video `js:"video"`
// The comment's author
Author BaseChannel
// The content of this comment
Content string `js:"content"`
// The publish date of the comment
PublishDate string `js:"publishDate"`
// How many likes does this comment have
LikeCount int64 `js:"likeCount"`
// Whether the comment is posted by the video uploader / owner
IsAuthorChannelOwner bool `js:"isAuthorChannelOwner"`
}
type Video ¶
type Video struct {
BaseVideo
// The duration of this video in second
Duration int64 `js:"duration"`
// Chapters on this video if exists
Chapters []Chapter
// Continuable of videos inside a Video
Comments VideoComments
// Music metadata (if exists)
Music Option[MusicMetadata]
}
type VideoCaptions ¶
type VideoCaptions struct {
// List of available languages for this video
Languages []CaptionLanguage `js:"languages"`
// contains filtered or unexported fields
}
func (*VideoCaptions) FromObject ¶
func (*VideoCaptions) Get ¶
func (x *VideoCaptions) Get(languageCode string, translationLanguageCode string) ([]Caption, error)
Get captions of a specific language or a translation of a specific language
func (*VideoCaptions) IsZero ¶
func (x *VideoCaptions) IsZero() bool
type VideoComments ¶
type VideoComments = Continuable[Comment]
type VideoCompact ¶
type VideoCompact struct {
ID string `js:"id"`
// The title of the video
Title string `js:"title"`
// Thumbnails of the video with different sizes
Thumbnails shared.Thumbnails
// Description of the video (not a full description, rather a preview / snippet)
Description string `js:"description"`
// The duration of this video in second, None if the video is live
Duration Option[int64]
// Whether this video is a live now or not
IsLive bool `js:"isLive"`
// Whether this video is a shorts or not
IsShort bool `js:"isShort"`
// The channel who uploads this video
Channel BaseChannel
// The date this video is uploaded at
UploadDate string `js:"uploadDate"`
// How many views does this video have, None if the view count is hidden
ViewCount Option[int64]
// Whether this video is private / deleted or not, only useful in playlist's videos
IsPrivateOrDeleted bool `js:"isPrivateOrDeleted"`
}
func (*VideoCompact) FromObject ¶
type VideoRelated ¶
type VideoRelated struct {
VideoCompact *VideoCompact
PlaylistCompact *PlaylistCompact
}
Click to show internal directories.
Click to hide internal directories.