ytapi

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

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

Go to latest
Published: Nov 30, 2023 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ApiUrl = "https://www.youtube.com/youtubei/v1"
	ApiKey = "AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Browse

type Browse struct {
	Contents struct {
		TwoColumnBrowseResultsRenderer struct {
			Tabs []struct {
				TabRenderer TabRenderer
			}
		}
	}
	Header struct {
		C4TabbedHeaderRenderer struct {
			Title  string
			Avatar struct {
				Thumbnails []Thumbnail
			}
			Banner struct {
				Thumbnails []Thumbnail
			}
			ChannelHandleText   RunsText
			SubscriberCountText Text
			VideosCountText     RunsText
		}
		PlaylistHeaderRenderer struct {
			NumVideosText RunsText
			ViewCountText Text
		}
	}
	Metadata struct {
		ChannelMetadataRenderer struct {
			Title  string
			Avatar struct {
				Thumbnails []Thumbnail
			}
		}
		PlaylistMetadataRenderer struct {
			Title       string
			Description string
		}
	}
	Microformat struct {
		MicroformatDataRenderer struct {
			Thumbnail struct {
				Thumbnails []Thumbnail
			}
		}
	}
}

type Caption

type Caption struct {
	BaseUrl        string
	Name           Text
	VssId          string
	LanguageCode   string
	TrackName      string
	IsTranslatable bool
}

type Client

type Client struct {
	Key               string
	UserAgent         string
	AndroidSdkVersion int64
	ClientName        string
	ClientNameProto   string
	ClientVersion     string
	OsName            string
	OsVersion         string
	Platform          string
}

func NewAndroidClient

func NewAndroidClient() *Client

func NewWebClient

func NewWebClient() *Client

func (*Client) Browse

func (c *Client) Browse(browseId, params string) (*Browse, error)

func (*Client) DecryptSignature

func (c *Client) DecryptSignature(id, sig string) (string, error)

func (*Client) Next

func (c *Client) Next(videoId string) (*Next, error)

func (*Client) Player

func (c *Client) Player(videoId string) (*Player, error)

func (*Client) Search

func (c *Client) Search(query string) (*Search, error)

type CompactVideoRenderer

type CompactVideoRenderer struct {
	VideoId   string
	Thumbnail struct {
		Thumbnails []Thumbnail
	}
	Title              Text
	PublishedTimeText  Text
	ViewCountText      Text
	LengthText         Text
	ShortViewCountText Text
}

type Format

type Format struct {
	ITag             int `json:"itag"`
	Url              string
	MimeType         string
	Bitrate          int
	Width            int
	Height           int
	LastModified     string
	ContentLength    string
	Quality          string
	FPS              int
	QualityLabel     string
	ProjectionType   string
	AverageBitrate   int
	ApproDurationsMs int
	AudioSampleRate  string
	AudioChannels    int
	SignatureCipher  string
	InitRange        struct {
		Start string
		End   string
	}
	IndexRange struct {
		Start string
		End   string
	}
}

type ItemSectionRendererItem

type ItemSectionRendererItem struct {
	VideoRenderer    *VideoRenderer
	PlaylistRenderer *PlaylistRenderer
	ShowRenderer     *ShowRenderer
}

type Next

type Next struct {
	Contents struct {
		TwoColumnWatchNextResults struct {
			SecondaryResults struct {
				SecondaryResults struct {
					Results []SecondaryResultItem
				}
			}
		}
	}
}

type Player

type Player struct {
	PlayabilityStatus struct {
		Status          string
		PlayableInEmbed bool
	}
	StreamingData struct {
		ExpiresInSeconds string
		Formats          []Format
		AdaptiveFormats  []Format
	}
	Captions struct {
		PlayerCaptionsTracklistRenderer struct {
			CaptionTracks []Caption
		}
	}
	VideoDetails struct {
		VideoId          string
		Title            string
		LengthSeconds    string
		Keywords         []string
		ChannelId        string
		IsOwnerViewing   bool
		ShortDescription string
		IsCrawable       bool
		Thumbnails       []Thumbnail
		AllowRatings     bool
		Author           string
		IsPrivate        bool
		IsUpluggedCorpus bool
		IsLiveContent    bool
	}
	Microformat struct {
		PlayerMicroformatRenderer struct {
			LengthSeconds      string
			OwnerProfileUrl    string
			IsFamilySafe       bool
			AvailableCountries []string
			IsUnlisted         bool
			HasYpsMetadata     bool
			ViewCount          string
			Category           string
			PublishDate        string
			UploadDate         string
		}
	}
}

type PlaylistRenderer

type PlaylistRenderer struct {
	PlaylistId string
	Title      Text
	Thumbnails []struct {
		Thumbnails []Thumbnail
	}
	VideoCount string
}

type PlaylistVideoListRendererItem

type PlaylistVideoListRendererItem struct {
	PlaylistVideoRenderer *PlaylistVideoRenderer
}

type PlaylistVideoRenderer

type PlaylistVideoRenderer struct {
	VideoId   string
	Thumbnail struct {
		Thumbnails []Thumbnail
	}
	Title struct {
		Runs []struct {
			Text string
		}
	}
	Index      Text
	LengthText Text
}

type RichItemRenderer

type RichItemRenderer struct {
	Content struct {
		VideoRenderer *VideoRenderer
	}
}

type RunsText

type RunsText struct {
	Runs []struct {
		Text string
	}
}
type Search struct {
	Contents struct {
		TwoColumnSearchResultsRenderer struct {
			PrimaryContents struct {
				SectionListRenderer struct {
					Contents []SectionListRendererItem
				}
			}
		}
	}
}

type SecondaryResultItem

type SecondaryResultItem struct {
	CompactVideoRenderer *CompactVideoRenderer
}

type SectionListRendererItem

type SectionListRendererItem struct {
	ItemSectionRenderer struct {
		Contents []ItemSectionRendererItem
	}
}

type ShowRenderer

type ShowRenderer struct {
	Title             Text
	ThumbnailRenderer struct {
		ShowCustomThumbnailRenderer struct {
			Thumbnail struct {
				Thumbnails []Thumbnail
			}
		}
	}
	NavigationEndpoint struct {
		WatchEndpoint struct {
			VideoId    string
			PlaylistId string
			Params     string
		}
	}
	ShortByLineText RunsText
}

type TabRenderer

type TabRenderer struct {
	Title   string
	Content struct {
		RichGridRenderer struct {
			Contents []struct {
				RichItemRenderer RichItemRenderer
			}
		}
		SectionListRenderer struct {
			Contents []struct {
				ItemSectionRenderer struct {
					Contents []struct {
						PlaylistVideoListRenderer struct {
							Contents []PlaylistVideoListRendererItem
						}
					}
				}
			}
		}
	}
}

type Text

type Text struct {
	SimpleText string
}

type Thumbnail

type Thumbnail struct {
	Url    string
	Width  float64
	Height float64
}

type VideoRenderer

type VideoRenderer struct {
	VideoId   string
	Thumbnail struct {
		Thumbnails []Thumbnail
	}
	Title struct {
		Runs []struct {
			Text string
		}
	}
	PublishedTimeText  Text
	LengthText         Text
	ViewCountText      Text
	OwnerText          Text
	ShortViewCountText Text
}

Jump to

Keyboard shortcuts

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