invidious

package module
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2026 License: MPL-2.0 Imports: 16 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

invidious-go

Go bindings for the Invidious API.

Documentation: https://pkg.go.dev/github.com/antoniszymanski/invidious-go

Installation:

go get github.com/antoniszymanski/invidious-go

Endpoints:

Endpoint Status Notes
GET /api/v1/stats ✅
GET /api/v1/videos/:id ✅
GET /api/v1/annotations/:id ❌
GET /api/v1/comments/:id ❌
GET /api/v1/captions/:id ❌
GET /api/v1/trending ❌
GET /api/v1/popular ❌
GET /api/v1/search/suggestions ❌
GET /api/v1/search ❌
GET /api/v1/playlists/:plid ❌
GET /api/v1/mixes/:rdid ❌
GET /api/v1/hashtag/:tag ❌
GET /api/v1/resolveurl ❌
GET /api/v1/clips ❌
GET /api/v1/channels/:id ❌
GET /api/v1/channels/:id/channels ❌
GET /api/v1/channels/:id/latest ❌
GET /api/v1/channels/:id/playlists ❌
GET /api/v1/channels/:id/podcasts ❌
GET /api/v1/channels/:id/releases ❌
GET /api/v1/channels/:id/shorts ❌
GET /api/v1/channels/:id/streams ❌
GET /api/v1/channels/:id/videos ❌
GET /api/v1/channels/:id/community ❌
GET /api/v1/channels/:ucid/search ❌
GET /api/v1/post/:id ❌
GET /api/v1/post/:id/comments ❌
GET /authorize_token ✅
GET /api/v1/auth/feed ✅
GET /api/v1/auth/notifications ❌ Won't be implemented
POST /api/v1/auth/notifications ❌ Won't be implemented
GET /api/v1/auth/playlists ✅
POST /api/v1/auth/playlists ✅
GET /api/v1/auth/playlists/:id ✅
PATCH /api/v1/auth/playlists/:id ✅
DELETE /api/v1/auth/playlists/:id ✅
POST /api/v1/auth/playlists/:id/videos ✅
DELETE /api/v1/auth/playlists/:id/videos/:index ✅
GET /api/v1/auth/preferences ✅
POST /api/v1/auth/preferences ❌
GET /api/v1/auth/subscriptions ✅
POST /api/v1/auth/subscriptions/:ucid ✅
DELETE /api/v1/auth/subscriptions/:ucid ✅
GET /api/v1/auth/tokens ✅
POST /api/v1/auth/tokens/register ✅
POST /api/v1/auth/tokens/unregister ✅
GET /api/v1/auth/history ✅
POST /api/v1/auth/history/:id ✅
DELETE /api/v1/auth/history/:id ✅

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Version

func Version() string

Types

type AddVideoRequest

type AddVideoRequest struct {
	PlaylistId string `json:"-"`
	VideoId    string `json:"videoId"`
}

type AddVideoResponse

type AddVideoResponse struct {
	Title           string `json:"title"`
	VideoId         string `json:"videoId"`
	Author          string `json:"author"`
	AuthorId        string `json:"authorId"`
	AuthorUrl       string `json:"authorUrl"`
	VideoThumbnails []struct {
		Quality string `json:"quality"`
		Url     string `json:"url"`
		Width   int32  `json:"width"`
		Height  int32  `json:"height"`
	} `json:"videoThumbnails"`
}

type AuthorizeTokenRequest added in v0.1.1

type AuthorizeTokenRequest struct {
	Scopes []string
	Expire time.Time
}

type ChannelObject added in v0.1.2

type ChannelObject struct {
	Type             string            `json:"type"` // "channel"
	Author           string            `json:"author"`
	AuthorId         string            `json:"authorId"`
	AuthorUrl        string            `json:"authorUrl"`
	AuthorVerified   bool              `json:"authorVerified"`
	AuthorThumbnails []ThumbnailObject `json:"authorThumbnails"`
	AutoGenerated    bool              `json:"autoGenerated"`
	SubCount         int64             `json:"subCount"`
	VideoCount       int64             `json:"videoCount"`
	Description      string            `json:"description"`
	DescriptionHtml  string            `json:"descriptionHtml"`
}

type ChannelResponse added in v0.1.2

type ChannelResponse struct {
	Author           string          `json:"author"`
	AuthorId         string          `json:"authorId"`
	AuthorUrl        string          `json:"authorUrl"`
	AuthorVerified   bool            `json:"authorVerified"`
	AuthorBanners    []ImageObject   `json:"authorBanners"`
	AuthorThumbnails []ImageObject   `json:"authorThumbnails"`
	SubCount         int64           `json:"subCount"`
	TotalViews       int64           `json:"totalViews"`
	Joined           time.Time       `json:"joined"`
	AutoGenerated    bool            `json:"autoGenerated"`
	IsFamilyFriendly bool            `json:"isFamilyFriendly"`
	Description      string          `json:"description"`
	DescriptionHtml  string          `json:"descriptionHtml"`
	AllowedRegions   []string        `json:"allowedRegions"`
	Tabs             []string        `json:"tabs"`
	LatestVideos     []VideoObject   `json:"latestVideos"`
	RelatedChannels  []ChannelObject `json:"relatedChannels"`
}

type Client

type Client struct {
	InstanceURL string
	RawToken    string
	UserAgent   string
	HTTPClient  *http.Client
}

func NewClient

func NewClient(instanceURL string) *Client

func (*Client) AddSubscription

func (c *Client) AddSubscription(ucid string) error

func (*Client) AddToHistory

func (c *Client) AddToHistory(id string) error

func (*Client) AddVideo

func (c *Client) AddVideo(req AddVideoRequest) (*AddVideoResponse, error)

func (*Client) AuthorizeToken

func (c *Client) AuthorizeToken(req AuthorizeTokenRequest) (err error)

func (*Client) Channel added in v0.1.2

func (c *Client) Channel(id string) (*ChannelResponse, error)

func (*Client) CreatePlaylist

func (c *Client) CreatePlaylist(req CreatePlaylistRequest) (*CreatePlaylistResponse, error)

func (*Client) DeleteFromHistory

func (c *Client) DeleteFromHistory(id string) error

func (*Client) DeletePlaylist

func (c *Client) DeletePlaylist(id string) error

func (*Client) DeleteVideo

func (c *Client) DeleteVideo(req DeleteVideoRequest) error

func (*Client) Feed

func (c *Client) Feed(req FeedRequest) (*FeedResponse, error)

func (*Client) History

func (c *Client) History(req HistoryRequest) (HistoryResponse, error)

func (*Client) Playlist

func (c *Client) Playlist(id string) (*PlaylistResponse, error)

func (*Client) Playlists

func (c *Client) Playlists() (PlaylistsResponse, error)

func (*Client) Preferences

func (c *Client) Preferences() (*PreferencesResponse, error)

func (*Client) RegisterToken

func (c *Client) RegisterToken(req RegisterTokenRequest) (*Token, error)

func (*Client) RemoveSubscription

func (c *Client) RemoveSubscription(ucid string) error

func (*Client) RevokeToken

func (c *Client) RevokeToken(req RevokeRequest) error

func (*Client) Stats

func (c *Client) Stats() (*StatsResponse, error)

func (*Client) Subscriptions

func (c *Client) Subscriptions() (SubscriptionsResponse, error)

func (*Client) Tokens

func (c *Client) Tokens() (TokensResponse, error)

func (*Client) UpdatePlaylist

func (c *Client) UpdatePlaylist(req UpdatePlaylistRequest) error

func (*Client) Video added in v0.1.2

func (c *Client) Video(req VideoRequest) (*VideoResponse, error)

type CreatePlaylistRequest

type CreatePlaylistRequest struct {
	Title   string  `json:"title"`
	Privacy Privacy `json:"privacy"`
}

type CreatePlaylistResponse

type CreatePlaylistResponse struct {
	Title      string `json:"title"`
	PlaylistId string `json:"playlistId"`
}

type DeleteVideoRequest

type DeleteVideoRequest struct {
	PlaylistId string
	IndexId    string
}

type Error

type Error struct {
	StatusCode int    `json:"-"`
	Message    string `json:"error"`
}

func (Error) Error

func (e Error) Error() string

type FeedRequest

type FeedRequest struct {
	MaxResults Option[int32]
	Page       Option[int32]
}

type FeedResponse

type FeedResponse struct {
	Notifications []struct {
		Type            string `json:"type"` // "shortVideo"
		Title           string `json:"title"`
		VideoId         string `json:"videoId"`
		VideoThumbnails []struct {
			Quality string `json:"quality"`
			Url     string `json:"url"`
			Width   int64  `json:"width"`
			Height  int64  `json:"height"`
		} `json:"videoThumbnails"`
		LengthSeconds int64  `json:"lengthSeconds"`
		Author        string `json:"author"`
		AuthorId      string `json:"authorId"`
		AuthorUrl     string `json:"authorUrl"`
		Published     int64  `json:"published"`
		PublishedText string `json:"publishedText"`
		ViewCount     int64  `json:"viewCount"`
	} `json:"notifications"`
	Videos []struct {
		Type            string `json:"type"` // "shortVideo"
		Title           string `json:"title"`
		VideoId         string `json:"videoId"`
		VideoThumbnails []struct {
			Quality string `json:"quality"`
			Url     string `json:"url"`
			Width   int64  `json:"width"`
			Height  int64  `json:"height"`
		} `json:"videoThumbnails"`
		LengthSeconds int64  `json:"lengthSeconds"`
		Author        string `json:"author"`
		AuthorId      string `json:"authorId"`
		AuthorUrl     string `json:"authorUrl"`
		Published     int64  `json:"published"`
		PublishedText string `json:"publishedText"`
		ViewCount     int64  `json:"viewCount"`
	} `json:"videos"`
}

type HistoryRequest

type HistoryRequest struct {
	MaxResults Option[int32]
	Page       Option[int32]
}

type HistoryResponse

type HistoryResponse []string

type ImageObject added in v0.1.2

type ImageObject struct {
	Url    string `json:"url"`
	Width  int64  `json:"width"`
	Height int64  `json:"height"`
}

type PlaylistObject added in v0.1.2

type PlaylistObject struct {
	Type              string `json:"type"` // "playlist"
	Title             string `json:"title"`
	PlaylistId        string `json:"playlistId"`
	PlaylistThumbnail string `json:"playlistThumbnail"`
	Author            string `json:"author"`
	AuthorId          string `json:"authorId"`
	AuthorUrl         string `json:"authorUrl"`
	AuthorVerified    bool   `json:"authorVerified"`
	VideoCount        int64  `json:"videoCount"`
	Videos            []struct {
		Title           string            `json:"title"`
		VideoId         string            `json:"videoId"`
		LengthSeconds   int64             `json:"lengthSeconds"`
		VideoThumbnails []ThumbnailObject `json:"videoThumbnails"`
	} `json:"videos"`
}

type PlaylistResponse

type PlaylistResponse struct {
	Title            string `json:"title"`
	PlaylistId       string `json:"playlistId"`
	Author           string `json:"author"`
	AuthorId         string `json:"authorId"`
	AuthorThumbnails []struct {
		Url    string `json:"url"`
		Width  string `json:"width"`
		Height string `json:"height"`
	} `json:"authorThumbnails"`
	Description     string `json:"description"`
	DescriptionHtml string `json:"descriptionHtml"`
	VideoCount      int32  `json:"videoCount"`
	ViewCount       int64  `json:"viewCount"`
	ViewCountText   string `json:"viewCountText"`
	Updated         int64  `json:"updated"`
	Videos          []struct {
		Title           string `json:"title"`
		VideoId         string `json:"videoId"`
		Author          string `json:"author"`
		AuthorId        string `json:"authorId"`
		AuthorUrl       string `json:"authorUrl"`
		VideoThumbnails []struct {
			Quality string `json:"quality"`
			Url     string `json:"url"`
			Width   int32  `json:"width"`
			Height  int32  `json:"height"`
		} `json:"videoThumbnails"`
		Index         int32  `json:"index"`
		IndexId       string `json:"indexId"`
		LengthSeconds int32  `json:"lengthSeconds"`
	} `json:"videos"`
}

type PlaylistsResponse

type PlaylistsResponse []struct {
	Type             string `json:"type"` // "invidiousPlaylist"
	Title            string `json:"title"`
	PlaylistId       string `json:"playlistId"`
	Author           string `json:"author"`
	AuthorId         any    `json:"authorId"`
	AuthorUrl        any    `json:"authorUrl"`
	AuthorThumbnails []any  `json:"authorThumbnails"`
	Description      string `json:"description"`
	DescriptionHtml  string `json:"descriptionHtml"`
	VideoCount       int32  `json:"videoCount"`
	ViewCount        int64  `json:"viewCount"`
	Updated          int64  `json:"updated"`
	IsListed         bool   `json:"isListed"`
	Videos           []struct {
		Title           string `json:"title"`
		VideoId         string `json:"videoId"`
		Author          string `json:"author"`
		AuthorId        string `json:"authorId"`
		AuthorUrl       string `json:"authorUrl"`
		VideoThumbnails []struct {
			Quality string `json:"quality"`
			Url     string `json:"url"`
			Width   int32  `json:"width"`
			Height  int32  `json:"height"`
		} `json:"videoThumbnails"`
		Index         int32  `json:"index"`
		IndexId       string `json:"indexId"`
		LengthSeconds int32  `json:"lengthSeconds"`
	} `json:"videos"`
}

type PreferencesResponse

type PreferencesResponse struct {
	Annotations           bool     `json:"annotations"`
	AnnotationsSubscribed bool     `json:"annotations_subscribed"`
	Autoplay              bool     `json:"autoplay"`
	Captions              []string `json:"captions"`
	Comments              []string `json:"comments"`
	Continue              bool     `json:"continue"`
	ContinueAutoplay      bool     `json:"continue_autoplay"`
	DarkMode              string   `json:"dark_mode"`
	LatestOnly            bool     `json:"latest_only"`
	Listen                bool     `json:"listen"`
	Local                 bool     `json:"local"`
	Locale                string   `json:"locale"`
	MaxResults            int32    `json:"max_results"`
	NotificationsOnly     bool     `json:"notifications_only"`
	PlayerStyle           string   `json:"player_style"`
	Quality               string   `json:"quality"`
	DefaultHome           string   `json:"default_home"`
	FeedMenu              []string `json:"feed_menu"`
	RelatedVideos         bool     `json:"related_videos"`
	Sort                  string   `json:"sort"`
	Speed                 float64  `json:"speed"`
	ThinMode              bool     `json:"thin_mode"`
	UnseenOnly            bool     `json:"unseen_only"`
	VideoLoop             bool     `json:"video_loop"`
	Volume                uint8    `json:"volume"`
}

type Privacy added in v0.1.1

type Privacy string
const (
	Public   Privacy = "public"
	Unlisted Privacy = "unlisted"
	Private  Privacy = "private"
)

type RegisterTokenRequest

type RegisterTokenRequest struct {
	Scopes      []string       `json:"scopes"`
	CallbackUrl Option[string] `json:"callbackUrl"`
	Expire      time.Time      `json:"expire"`
}

type RevokeRequest

type RevokeRequest struct {
	Session string `json:"session"`
}

type StatsResponse

type StatsResponse struct {
	Version  string `json:"version"`
	Software struct {
		Name    string `json:"name"` // "invidious"
		Version string `json:"version"`
		Branch  string `json:"branch"`
	} `json:"software"`
	OpenRegistrations bool `json:"openRegistrations"`
	Usage             struct {
		Users struct {
			Total          int32 `json:"total"`
			ActiveHalfyear int32 `json:"activeHalfyear"`
			ActiveMonth    int32 `json:"activeMonth"`
		} `json:"users"`
	} `json:"usage"`
	Metadata struct {
		UpdatedAt              int64 `json:"updatedAt"`
		LastChannelRefreshedAt int64 `json:"lastChannelRefreshedAt"`
	} `json:"metadata"`
	Playback struct {
		TotalRequests      Option[int32]   `json:"totalRequests"`
		SuccessfulRequests Option[int32]   `json:"successfulRequests"`
		Ratio              Option[float32] `json:"ratio"`
	} `json:"playback"`
}

type SubscriptionsResponse

type SubscriptionsResponse []struct {
	Author   string `json:"author"`
	AuthorId string `json:"authorId"`
}

type ThumbnailObject added in v0.1.2

type ThumbnailObject struct {
	Quality string `json:"quality"`
	Url     string `json:"url"`
	Width   int64  `json:"width"`
	Height  int64  `json:"height"`
}

type Token

type Token struct {
	Session   string    `json:"session"`
	Scopes    []string  `json:"scopes"`
	Expire    time.Time `json:"expire"`
	Signature string    `json:"signature"`
}

func ParseToken

func ParseToken(in string) (*Token, error)

func (*Token) Encode

func (t *Token) Encode() (string, error)

type TokensResponse

type TokensResponse []struct {
	Session string `json:"session"`
	Issued  int64  `json:"issued"`
}

type UpdatePlaylistRequest

type UpdatePlaylistRequest struct {
	Id          string          `json:"-"`
	Title       Option[string]  `json:"title"`
	Description Option[string]  `json:"description"`
	Privacy     Option[Privacy] `json:"privacy"`
}

type VideoObject added in v0.1.2

type VideoObject struct {
	Type            string            `json:"type"` // "video"
	Title           string            `json:"title"`
	VideoId         string            `json:"videoId"`
	Author          string            `json:"author"`
	AuthorId        string            `json:"authorId"`
	AuthorUrl       string            `json:"authorUrl"`
	AuthorVerified  bool              `json:"authorVerified"`
	VideoThumbnails []ThumbnailObject `json:"videoThumbnails"`
	Description     string            `json:"description"`
	DescriptionHtml string            `json:"descriptionHtml"`
	ViewCount       int64             `json:"viewCount"`
	ViewCountText   string            `json:"viewCountText"`
	LengthSeconds   int64             `json:"lengthSeconds"`
	Published       time.Time         `json:"published"`
	PublishedText   string            `json:"publishedText"`
	// Only available on premiered videos
	PremiereTimestamp time.Time `json:"premiereTimestamp"`
	LiveNow           bool      `json:"liveNow"`
	Premium           bool      `json:"premium"`
	IsUpcoming        bool      `json:"isUpcoming"`
	IsNew             bool      `json:"isNew"`
	Is4k              bool      `json:"is4K"`
	Is8k              bool      `json:"is8K"`
	IsVr180           bool      `json:"isVr180"`
	IsVr360           bool      `json:"isVr360"`
	Is3d              bool      `json:"is3D"`
	HasCaptions       bool      `json:"hasCaptions"`
}

type VideoRequest added in v0.1.2

type VideoRequest struct {
	Id     string
	Region string // ISO 3166 country code (default: "US")
}

type VideoResponse added in v0.1.2

type VideoResponse struct {
	Type            string `json:"type"` // "video"|"published"
	Title           string `json:"title"`
	VideoId         string `json:"videoId"`
	VideoThumbnails []struct {
		Quality string `json:"quality"`
		Url     string `json:"url"`
		Width   int32  `json:"width"`
		Height  int32  `json:"height"`
	} `json:"videoThumbnails"`
	Storyboards []struct {
		Url              string `json:"url"`
		TemplateUrl      string `json:"templateUrl"`
		Width            int32  `json:"width"`
		Height           int32  `json:"height"`
		Count            int32  `json:"count"`
		Interval         int32  `json:"interval"`
		StoryboardWidth  int32  `json:"storyboardWidth"`
		StoryboardHeight int32  `json:"storyboardHeight"`
		StoryboardCount  int32  `json:"storyboardCount"`
	} `json:"storyboards"`
	Description      string   `json:"description"`
	DescriptionHtml  string   `json:"descriptionHtml"`
	Published        int64    `json:"published"`
	PublishedText    string   `json:"publishedText"`
	Keywords         []string `json:"keywords"`
	ViewCount        int64    `json:"viewCount"`
	LikeCount        int32    `json:"likeCount"`
	DislikeCount     int32    `json:"dislikeCount"`
	Paid             bool     `json:"paid"`
	Premium          bool     `json:"premium"`
	IsFamilyFriendly bool     `json:"isFamilyFriendly"`
	AllowedRegions   []string `json:"allowedRegions"`
	Genre            string   `json:"genre"`
	GenreUrl         string   `json:"genreUrl"`
	Author           string   `json:"author"`
	AuthorId         string   `json:"authorId"`
	AuthorUrl        string   `json:"authorUrl"`
	AuthorThumbnails []struct {
		Url    string `json:"url"`
		Width  int32  `json:"width"`
		Height int32  `json:"height"`
	} `json:"authorThumbnails"`
	SubCountText      string         `json:"subCountText"`
	LengthSeconds     int32          `json:"lengthSeconds"`
	AllowRatings      bool           `json:"allowRatings"`
	Rating            float32        `json:"rating"`
	IsListed          bool           `json:"isListed"`
	LiveNow           bool           `json:"liveNow"`
	IsPostLiveDvr     bool           `json:"isPostLiveDvr"`
	IsUpcoming        bool           `json:"isUpcoming"`
	DashUr            string         `json:"dashUr"`
	PremiereTimestamp Option[int64]  `json:"premiereTimestamp"`
	HlsUrl            Option[string] `json:"hlsUrl"`
	AdaptiveFormats   []struct {
		Index             string         `json:"index"`
		Bitrate           string         `json:"bitrate"`
		Init              string         `json:"init"`
		Url               string         `json:"url"`
		Itag              string         `json:"itag"`
		Type              string         `json:"type"`
		Clen              string         `json:"clen"`
		Lmt               string         `json:"lmt"`
		ProjectionType    string         `json:"projectionType"`
		Container         string         `json:"container"`
		Encoding          string         `json:"encoding"`
		QualityLabel      Option[string] `json:"qualityLabel"`
		Resolution        Option[string] `json:"resolution"`
		Fps               int32          `json:"fps"`
		Size              Option[string] `json:"size"`
		TargetDurationsec Option[int64]  `json:"targetDurationsec"`
		MaxDvrDurationSec Option[int64]  `json:"maxDvrDurationSec"`
		AudioQuality      Option[string] `json:"audioQuality"`
		AudioSampleRate   Option[string] `json:"audioSampleRate"`
		AudioChannels     Option[string] `json:"audioChannels"`
		ColorInfo         Option[string] `json:"colorInfo"`
		CaptionTrack      Option[string] `json:"captionTrack"`
	} `json:"adaptiveFormats"`
	FormatStreams []struct {
		Url          string         `json:"url"`
		Itag         string         `json:"itag"`
		Type         string         `json:"type"`
		Quality      string         `json:"quality"`
		Bitrate      Option[string] `json:"bitrate"`
		Container    string         `json:"container"`
		Encoding     string         `json:"encoding"`
		QualityLabel string         `json:"qualityLabel"`
		Resolution   string         `json:"resolution"`
		Size         string         `json:"size"`
	} `json:"formatStreams"`
	Captions []struct {
		Label         string `json:"label"`
		Language_code string `json:"language_Code"`
		Url           string `json:"url"`
	} `json:"captions"`
	MusicTracks []struct {
		Song    string `json:"song"`
		Artist  string `json:"artist"`
		Album   string `json:"album"`
		License string `json:"license"`
	} `json:"musicTracks"`
	RecommendedVideos []struct {
		VideoId         string `json:"videoId"`
		Title           string `json:"title"`
		VideoThumbnails []struct {
			Quality string `json:"quality"`
			Url     string `json:"url"`
			Width   int32  `json:"width"`
			Height  int32  `json:"height"`
		} `json:"videoThumbnails"`
		Author           string         `json:"author"`
		AuthorUrl        string         `json:"authorUrl"`
		AuthorId         Option[string] `json:"authorId"`
		AuthorVerified   bool           `json:"authorVerified"`
		AuthorThumbnails []struct {
			Url    string `json:"url"`
			Width  int32  `json:"width"`
			Height int32  `json:"height"`
		} `json:"authorThumbnails"`
		LengthSeconds int32  `json:"lengthSeconds"`
		ViewCount     int64  `json:"viewCount"`
		ViewCountText string `json:"viewCountText"`
	} `json:"recommendedVideos"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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