types

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2021 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FormatVideoOnly = 1 << iota
	FormatAudioOnly
	Format3D
	FormatHLS
	FormatDASH
	FormatHighFps
	FormatStd = 0
)
View Source
const (
	VisibilityPublic
	VisibilityUnlisted
	VisibilityPrivate
)

Variables

View Source
var Formats = []Format{

	{"5", "flv", 400, 240, "h263", "mp3", 64, FormatStd},
	{"6", "flv", 450, 270, "h263", "mp3", 64, FormatStd},
	{"13", "3gp", 0, 0, "mp4v", "aac", 0, FormatStd},
	{"17", "3gp", 176, 144, "mp4v", "aac", 24, FormatStd},
	{"18", "mp4", 640, 360, "h264", "aac", 96, FormatStd},
	{"22", "mp4", 1280, 720, "h264", "aac", 192, FormatStd},
	{"34", "flv", 640, 360, "h264", "aac", 128, FormatStd},
	{"35", "flv", 854, 480, "h264", "aac", 128, FormatStd},

	{"36", "3gp", 320, 0, "mp4v", "aac", 0, FormatStd},
	{"37", "mp4", 1920, 1080, "h264", "aac", 192, FormatStd},
	{"38", "mp4", 4096, 3072, "h264", "aac", 192, FormatStd},
	{"43", "webm", 640, 360, "vp8", "vorbis", 128, FormatStd},
	{"44", "webm", 854, 480, "vp8", "vorbis", 128, FormatStd},
	{"45", "webm", 1280, 720, "vp8", "vorbis", 192, FormatStd},
	{"46", "webm", 1920, 1080, "vp8", "vorbis", 192, FormatStd},
	{"59", "mp4", 854, 480, "h264", "aac", 128, FormatStd},
	{"78", "mp4", 854, 480, "h264", "aac", 128, FormatStd},

	{"82", "mp4", 0, 360, "h264", "aac", 128, Format3D},
	{"83", "mp4", 0, 480, "h264", "aac", 128, Format3D},
	{"84", "mp4", 0, 720, "h264", "aac", 192, Format3D},
	{"85", "mp4", 0, 1080, "h264", "aac", 192, Format3D},
	{"100", "webm", 0, 360, "vp8", "vorbis", 128, Format3D},
	{"101", "webm", 0, 480, "vp8", "vorbis", 192, Format3D},
	{"102", "webm", 0, 720, "vp8", "vorbis", 192, Format3D},

	{"91", "mp4", 0, 144, "h264", "aac", 48, FormatHLS},
	{"92", "mp4", 0, 240, "h264", "aac", 48, FormatHLS},
	{"93", "mp4", 0, 360, "h264", "aac", 128, FormatHLS},
	{"94", "mp4", 0, 480, "h264", "aac", 128, FormatHLS},
	{"95", "mp4", 0, 720, "h264", "aac", 256, FormatHLS},
	{"96", "mp4", 0, 1080, "h264", "aac", 256, FormatHLS},
	{"132", "mp4", 0, 240, "h264", "aac", 48, FormatHLS},
	{"151", "mp4", 0, 72, "h264", "aac", 24, FormatHLS},

	{"133", "mp4", 0, 240, "h264", "", 0, FormatDASH | FormatVideoOnly},
	{"134", "mp4", 0, 360, "h264", "", 0, FormatDASH | FormatVideoOnly},
	{"135", "mp4", 0, 480, "h264", "", 0, FormatDASH | FormatVideoOnly},
	{"136", "mp4", 0, 720, "h264", "", 0, FormatDASH | FormatVideoOnly},
	{"137", "mp4", 0, 1080, "h264", "", 0, FormatDASH | FormatVideoOnly},
	{"138", "mp4", 0, 0, "h264", "", 0, FormatDASH | FormatVideoOnly},
	{"160", "mp4", 0, 144, "h264", "", 0, FormatDASH | FormatVideoOnly},
	{"212", "mp4", 0, 480, "h264", "", 0, FormatDASH | FormatVideoOnly},
	{"264", "mp4", 0, 1440, "h264", "", 0, FormatDASH | FormatVideoOnly},
	{"298", "mp4", 0, 720, "h264", "", 0, FormatDASH | FormatVideoOnly | FormatHighFps},
	{"299", "mp4", 0, 1080, "h264", "", 0, FormatDASH | FormatVideoOnly | FormatHighFps},
	{"266", "mp4", 0, 2160, "h264", "", 0, FormatDASH | FormatVideoOnly},

	{"139", "m4a", 0, 0, "", "aac", 48, FormatDASH | FormatAudioOnly},
	{"140", "m4a", 0, 0, "", "aac", 128, FormatDASH | FormatAudioOnly},
	{"141", "m4a", 0, 0, "", "aac", 256, FormatDASH | FormatAudioOnly},
	{"256", "m4a", 0, 0, "", "aac", 0, FormatDASH | FormatAudioOnly},
	{"258", "m4a", 0, 0, "", "aac", 0, FormatDASH | FormatAudioOnly},
	{"325", "m4a", 0, 0, "", "dtse", 0, FormatDASH | FormatAudioOnly},
	{"328", "m4a", 0, 0, "", "ec-3", 0, FormatDASH | FormatAudioOnly},

	{"167", "webm", 640, 360, "vp8", "", 0, FormatDASH | FormatVideoOnly},
	{"168", "webm", 854, 480, "vp8", "", 0, FormatDASH | FormatVideoOnly},
	{"169", "webm", 1280, 720, "vp8", "", 0, FormatDASH | FormatVideoOnly},
	{"170", "webm", 1920, 1080, "vp8", "", 0, FormatDASH | FormatVideoOnly},
	{"218", "webm", 854, 480, "vp8", "", 0, FormatDASH | FormatVideoOnly},
	{"219", "webm", 854, 480, "vp8", "", 0, FormatDASH | FormatVideoOnly},
	{"278", "webm", 0, 144, "vp9", "", 0, FormatDASH | FormatVideoOnly},
	{"242", "webm", 0, 240, "vp9", "", 0, FormatDASH | FormatVideoOnly},
	{"243", "webm", 0, 360, "vp9", "", 0, FormatDASH | FormatVideoOnly},
	{"244", "webm", 0, 480, "vp9", "", 0, FormatDASH | FormatVideoOnly},
	{"245", "webm", 0, 480, "vp9", "", 0, FormatDASH | FormatVideoOnly},
	{"246", "webm", 0, 480, "vp9", "", 0, FormatDASH | FormatVideoOnly},
	{"247", "webm", 0, 720, "vp9", "", 0, FormatDASH | FormatVideoOnly},
	{"248", "webm", 0, 1080, "vp9", "", 0, FormatDASH | FormatVideoOnly},
	{"271", "webm", 0, 1440, "vp9", "", 0, FormatDASH | FormatVideoOnly},

	{"272", "webm", 0, 2160, "vp9", "", 0, FormatDASH | FormatVideoOnly},
	{"302", "webm", 0, 720, "vp9", "", 0, FormatDASH | FormatVideoOnly | FormatHighFps},
	{"303", "webm", 0, 1080, "vp9", "", 0, FormatDASH | FormatVideoOnly | FormatHighFps},
	{"308", "webm", 0, 1440, "vp9", "", 0, FormatDASH | FormatVideoOnly | FormatHighFps},
	{"313", "webm", 0, 2160, "vp9", "", 0, FormatDASH | FormatVideoOnly},
	{"315", "webm", 0, 2160, "vp9", "", 0, FormatDASH | FormatVideoOnly | FormatHighFps},

	{"171", "webm", 0, 0, "", "vorbis", 128, FormatDASH | FormatAudioOnly},
	{"172", "webm", 0, 0, "", "vorbis", 256, FormatDASH | FormatAudioOnly},

	{"249", "webm", 0, 0, "", "opus", 50, FormatDASH | FormatAudioOnly},
	{"250", "webm", 0, 0, "", "opus", 70, FormatDASH | FormatAudioOnly},
	{"251", "webm", 0, 0, "", "opus", 160, FormatDASH | FormatAudioOnly},
}

Formats from github.com/rg3/youtube-dl As in youtube_dl/extractor/youtube.py

View Source
var FormatsById map[string]*Format

Functions

This section is empty.

Types

type Caption

type Caption struct {
	VssID        string
	Name         string
	Code         string
	Translatable bool
}
type ChannelHeaderLinks struct {
	Twitch  string `json:",omitempty"`
	Twitter string `json:",omitempty"`
	Patreon string `json:",omitempty"`
	Reddit  string `json:",omitempty"`
	Discord string `json:",omitempty"`
	TikTok  string `json:",omitempty"`
}

type ChannelOverview

type ChannelOverview struct {
	ChannelID string
	Title     string
	Links     ChannelHeaderLinks
	Verified  bool
	Sponsored bool
}

type ChannelVideosPage

type ChannelVideosPage struct {
	Continuation string
	Videos       []VideoItem
}

type Comment

type Comment struct {
	// Static
	ID             string
	VideoID        string
	AuthorID       string
	ByChannelOwner bool   `json:",omitempty"`
	ParentID       string `json:",omitempty"`

	// Static target: Accuracy-improving changes
	CreatedText   string
	CreatedBefore int64
	CreatedAfter  int64

	// Malleable: Author-triggered changes
	Author  string
	Content json.RawMessage
	Edited  bool `json:",omitempty"`

	// Dynamic
	CrawledAt  int64
	LikeCount  uint64
	ReplyCount uint64 `json:",omitempty"`

	// Application-specific (not exported)
	Internal interface{} `json:"-"`
}

A Comment on a YouTube video.

type CommentContinuation

type CommentContinuation struct {
	VideoID  string
	ParentID string
	Cookie   string
	Token    string
	XSRF     string
}

type CommentPage

type CommentPage struct {
	Comments         []Comment
	CommentParseErrs []error
	MoreComments     bool
	Continuation     *CommentContinuation
	TopComments      *CommentContinuation
	NewComments      *CommentContinuation
}

type Format

type Format struct {
	ID           string     `json:"id"`
	Extension    string     `json:"ext"`
	Width        uint32     `json:"width"`
	Height       uint32     `json:"height"`
	VideoCodec   string     `json:"vcodec"`
	AudioCodec   string     `json:"acodec"`
	AudioBitrate uint32     `json:"abr"`
	Flags        FormatType `json:"flags"`
}

Format is the video/audio stream format of a video.

type FormatType

type FormatType uint8

func (FormatType) MarshalJSON

func (f FormatType) MarshalJSON() ([]byte, error)

type LivechatMessage

type LivechatMessage struct {
	ID        string
	Message   json.RawMessage
	AuthorID  string
	Author    string
	Timestamp int64

	// Super Chat specific
	SuperChat  bool
	PaidAmount string `json:",omitempty"`
}

LivechatMessage is a message or super chat in YouTube live chats.

type Livestream

type Livestream struct {
	LowLatency   bool
	DvrEnabled   bool
	OwnerViewing bool
	LiveContent  bool
}

type Playlist

type Playlist struct {
	ID    string
	Title string
	Views int64
	Page  PlaylistPage
}

type PlaylistPage

type PlaylistPage struct {
	Continuation string
	Videos       []VideoItem
}

type RelatedVideo

type RelatedVideo struct {
	ID         string
	UploaderID string
}

type Video

type Video struct {
	// Static data
	ID         string
	Uploaded   int64 `json:",omitempty"`
	Duration   uint64
	UploaderID string
	Formats    []string `json:",omitempty"`

	// Content metadata
	Uploader       string
	Title          string
	Description    string
	License        string `json:",omitempty"`
	Genre          string
	Tags           []string  `json:",omitempty"`
	Captions       []Caption `json:",omitempty"`
	FamilyFriendly bool
	Livestream     *Livestream `json:",omitempty"`

	// Continuations
	TopChatContinuation        string `json:",omitempty"`
	LiveChatContinuation       string `json:",omitempty"`
	TopChatReplayContinuation  string `json:",omitempty"`
	LiveChatReplayContinuation string `json:",omitempty"`

	// Privacy settings
	Visibility       VisibilitySetting
	NoComments       bool `json:",omitempty"`
	NoRatings        bool `json:",omitempty"`
	NoEmbed          bool `json:",omitempty"`
	ProductPlacement bool `json:",omitempty"`
	WatchStatistics  bool `json:",omitempty"`

	// Dynamic stats
	Views         uint64
	Likes         uint64
	Dislikes      uint64
	RelatedVideos []RelatedVideo

	// Internal tokens
	Internal interface{} `json:"-"`
}

A Video on YouTube.

type VideoItem

type VideoItem struct {
	ID          string
	Title       string
	ChannelID   string `json:",omitempty"`
	ChannelName string `json:",omitempty"`
	Unavailable bool   `json:",omitempty"`
	IsLive      bool   `json:",omitempty"`
}

VideoItem is a video in a list reference.

type VisibilitySetting

type VisibilitySetting uint8

func (VisibilitySetting) MarshalJSON

func (t VisibilitySetting) MarshalJSON() ([]byte, error)

Jump to

Keyboard shortcuts

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