invidious

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const PlaylistEntryPrefix = "invidtui.video."

Variables

This section is empty.

Functions

func AddSubscription

func AddSubscription(id string) error

AddSubscription adds a channel to the user's subscriptions.

func AddVideoToPlaylist

func AddVideoToPlaylist(plid, videoID string) error

AddVideoToPlaylist adds a video to the user's playlist.

func CheckLiveURL

func CheckLiveURL(uri string, audio bool) (string, bool)

CheckLiveURL returns whether the provided live video's URL has expired or not.

func CreatePlaylist

func CreatePlaylist(title, privacy string) error

CreatePlaylist creates a playlist for the user.

func DownloadParams

func DownloadParams(ctx context.Context, id, itag, filename string) (*http.Response, *os.File, error)

DownloadParams returns parameters that are used to download a file.

func EditPlaylist

func EditPlaylist(id, title, description, privacy string) error

EditPlaylist edits a user's playlist properties.

func GeneratePlaylist added in v0.3.6

func GeneratePlaylist(file string, list []VideoData, flags int, appendToFile bool) (string, int, error)

GeneratePlaylist generates a playlist file.

func PlaylistVideos added in v0.3.7

func PlaylistVideos(ctx context.Context, id string, auth bool, add func(stats [3]int64)) (PlaylistData, []VideoData, error)

PlaylistVideos retrieves a playlist's videos only.

func RemovePlaylist

func RemovePlaylist(id string) error

RemovePlaylist removes a user's playlist.

func RemoveSubscription

func RemoveSubscription(id string) error

RemoveSubscription removes a user's subscription.

func RemoveVideoFromPlaylist

func RemoveVideoFromPlaylist(plid, index string) error

RemoveVideoFromPlaylist removes a video from the user's playlist.

func VideoThumbnail

func VideoThumbnail(ctx context.Context, id, image string) (*http.Response, error)

VideoThumbnail returns data to parse a video thumbnail.

Types

type ChannelData

type ChannelData struct {
	Title        string          `json:"title"`
	ChannelID    string          `json:"authorId"`
	Author       string          `json:"author"`
	Description  string          `json:"description"`
	ViewCount    int64           `json:"viewCount"`
	Continuation string          `json:"continuation"`
	Videos       []PlaylistVideo `json:"videos"`
	Playlists    []PlaylistData  `json:"playlists"`
}

ChannelData stores channel related data.

func Channel

func Channel(id, stype, continuation string, channel ...ChannelData) (ChannelData, error)

Channel retrieves information about a channel.

func ChannelPlaylists

func ChannelPlaylists(id, continuation string) (ChannelData, error)

ChannelPlaylists loads only the playlists present in the channel.

func ChannelReleases added in v0.3.8

func ChannelReleases(id, continuation string) (ChannelData, error)

ChannelReleases loads only the releases present in the channel.

func ChannelVideos

func ChannelVideos(id, continuation string) (ChannelData, error)

ChannelVideos retrieves video information from a channel.

type CommentData

type CommentData struct {
	Verified             bool         `json:"verified"`
	Author               string       `json:"author"`
	AuthorID             string       `json:"authorId"`
	AuthorURL            string       `json:"authorUrl"`
	Content              string       `json:"content"`
	PublishedText        string       `json:"publishedText"`
	LikeCount            int          `json:"likeCount"`
	CommentID            string       `json:"commentId"`
	AuthorIsChannelOwner bool         `json:"authorIsChannelOwner"`
	Replies              CommentReply `json:"replies"`
}

CommentData stores information about a comment.

type CommentReply

type CommentReply struct {
	ReplyCount   int    `json:"replyCount"`
	Continuation string `json:"continuation"`
}

CommentReply stores information about comment replies.

type CommentsData

type CommentsData struct {
	Comments     []CommentData `json:"comments"`
	Continuation string        `json:"continuation"`
}

CommentsData stores comments and its continuation data.

func Comments

func Comments(id string, continuation ...string) (CommentsData, error)

Comments retrieves comments for a video.

type FeedData

type FeedData struct {
	Videos []FeedVideos `json:"videos"`
}

FeedData stores videos in the user's feed.

func Feed

func Feed(page int) (FeedData, error)

Feed retrieves videos from a user's feed.

type FeedVideos

type FeedVideos struct {
	Type          string `json:"type"`
	Title         string `json:"title"`
	VideoID       string `json:"videoId"`
	LengthSeconds int64  `json:"lengthSeconds"`
	Author        string `json:"author"`
	AuthorID      string `json:"authorId"`
	AuthorURL     string `json:"authorUrl"`
	PublishedText string `json:"publishedText"`
	ViewCount     int64  `json:"viewCount"`
}

FeedVideos stores information about a video in the user's feed.

type PlaylistData

type PlaylistData struct {
	Title       string          `json:"title"`
	PlaylistID  string          `json:"playlistId"`
	Author      string          `json:"author"`
	AuthorID    string          `json:"authorId"`
	Description string          `json:"description"`
	VideoCount  int64           `json:"videoCount"`
	ViewCount   int64           `json:"viewCount"`
	Videos      []PlaylistVideo `json:"videos"`
}

PlaylistData stores information about a playlist.

func Playlist

func Playlist(id string, auth bool, page int, ctx ...context.Context) (PlaylistData, error)

Playlist retrieves a playlist and its videos.

func UserPlaylists

func UserPlaylists() ([]PlaylistData, error)

UserPlaylists retrieves the user's playlists.

type PlaylistVideo

type PlaylistVideo struct {
	Title         string `json:"title"`
	Author        string `json:"author"`
	Index         int32  `json:"index"`
	IndexID       string `json:"indexId"`
	VideoID       string `json:"videoId"`
	AuthorID      string `json:"authorId"`
	LengthSeconds int64  `json:"lengthSeconds"`
}

PlaylistVideo stores information about a video in the playlist.

type SearchData

type SearchData struct {
	Type          string `json:"type"`
	Title         string `json:"title"`
	AuthorID      string `json:"authorId"`
	VideoID       string `json:"videoId"`
	PlaylistID    string `json:"playlistId"`
	Author        string `json:"author"`
	IndexID       string `json:"indexId"`
	ViewCountText string `json:"viewCountText"`
	PublishedText string `json:"publishedText"`
	Duration      string `json:"duration"`
	Description   string `json:"description"`
	VideoCount    int64  `json:"videoCount"`
	SubCount      int    `json:"subCount"`
	LengthSeconds int64  `json:"lengthSeconds"`
	LiveNow       bool   `json:"liveNow"`

	Timestamp *int64
}

SearchData stores information about a search result.

func ChannelSearch

func ChannelSearch(id, searchText string, page int) ([]SearchData, int, error)

ChannelSearch searches for a query string in the channel.

func GetSearchData added in v0.4.3

func GetSearchData(info interface{}, d ...SearchData) SearchData

GetSearchData returns the SearchData according to the provided info.

func Search(stype, text string, parameters map[string]string, page int, ucid ...string) ([]SearchData, int, error)

Search retrieves search results according to the provided query.

type SubscriptionData

type SubscriptionData []struct {
	Author   string `json:"author"`
	AuthorID string `json:"authorId"`
}

SubscriptionData stores information about the user's subscriptions.

func Subscriptions

func Subscriptions() (SubscriptionData, error)

Subscriptions retrieves the user's subscriptions.

type SuggestData

type SuggestData struct {
	Query       string   `json:"query"`
	Suggestions []string `json:"suggestions"`
}

SuggestData stores search suggestions.

func SearchSuggestions

func SearchSuggestions(text string) (SuggestData, error)

SearchSuggestions retrieves search suggestions.

type VideoData

type VideoData struct {
	Title             string            `json:"title"`
	Author            string            `json:"author"`
	AuthorID          string            `json:"authorId"`
	VideoID           string            `json:"videoId"`
	HlsURL            string            `json:"hlsUrl"`
	LengthSeconds     int64             `json:"lengthSeconds"`
	LiveNow           bool              `json:"liveNow"`
	ViewCount         int               `json:"viewCount"`
	LikeCount         int               `json:"likeCount"`
	PublishedText     string            `json:"publishedText"`
	SubCountText      string            `json:"subCountText"`
	Description       string            `json:"description"`
	Thumbnails        []VideoThumbnails `json:"videoThumbnails"`
	FormatStreams     []VideoFormat     `json:"formatStreams"`
	AdaptiveFormats   []VideoFormat     `json:"adaptiveFormats"`
	RecommendedVideos []VideoData       `json:"recommendedVideos"`

	MediaType string
	Timestamp *int64
}

VideoData stores information about a video.

func RenewVideoURI added in v0.3.7

func RenewVideoURI(ctx context.Context, uri [2]string, video VideoData, audio bool) (VideoData, [2]string, error)

RenewVideoURI renews the video's media URIs.

func Video

func Video(id string, ctx ...context.Context) (VideoData, error)

Video retrieves a video.

type VideoFormat

type VideoFormat struct {
	Type            string `json:"type"`
	URL             string `json:"url"`
	Itag            string `json:"itag"`
	Container       string `json:"container"`
	Encoding        string `json:"encoding"`
	Resolution      string `json:"resolution,omitempty"`
	Bitrate         int64  `json:"bitrate,string"`
	ContentLength   int64  `json:"clen,string"`
	FPS             int    `json:"fps"`
	AudioSampleRate int    `json:"audioSampleRate"`
	AudioChannels   int    `json:"audioChannels"`
}

VideoFormat stores information about the video's format.

type VideoThumbnails

type VideoThumbnails struct {
	Quality string `json:"quality"`
	URL     string `json:"url"`
	Width   int    `json:"width"`
	Height  int    `json:"height"`
}

VideoThumbnails stores the video's thumbnails.

Jump to

Keyboard shortcuts

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