Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var FORMATS = map[int]Format{ 5: { FormatExtensionKey: "flv", FormatResolutionKey: "240p", FormatVideoEncodingKey: "Sorenson H.283", FormatProfileKey: nil, FormatAudioEncodingKey: "mp3", }, 6: { FormatExtensionKey: "flv", FormatResolutionKey: "270p", FormatVideoEncodingKey: "Sorenson H.263", FormatProfileKey: nil, FormatAudioEncodingKey: "mp3", }, 13: { FormatExtensionKey: "3gp", FormatResolutionKey: nil, FormatVideoEncodingKey: "MPEG-4 Visual", FormatProfileKey: nil, FormatAudioEncodingKey: "aac", }, 17: { FormatExtensionKey: "3gp", FormatResolutionKey: "144p", FormatVideoEncodingKey: "MPEG-4 Visual", FormatAudioEncodingKey: "aac", FormatProfileKey: nil, }, 18: { FormatExtensionKey: "mp4", FormatResolutionKey: "360p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "baseline", FormatAudioEncodingKey: "aac", }, 22: { FormatExtensionKey: "mp4", FormatResolutionKey: "720p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "high", FormatAudioEncodingKey: "aac", }, 34: { FormatExtensionKey: "flv", FormatResolutionKey: "480p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "main", FormatAudioEncodingKey: "aac", }, 35: { FormatExtensionKey: "flv", FormatResolutionKey: "360p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "main", FormatAudioEncodingKey: "aac", }, 36: { FormatExtensionKey: "3gp", FormatResolutionKey: "240p", FormatVideoEncodingKey: "MPEG-4 Visual", FormatProfileKey: "simple", FormatAudioEncodingKey: "aac", }, 37: { FormatExtensionKey: "mp4", FormatResolutionKey: "1080p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "high", FormatAudioEncodingKey: "aac", }, 38: { FormatExtensionKey: "mp4", FormatResolutionKey: "3072p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "high", FormatAudioEncodingKey: "aac", }, 43: { FormatExtensionKey: "webm", FormatResolutionKey: "360p", FormatVideoEncodingKey: "VP8", FormatProfileKey: nil, FormatAudioEncodingKey: "vorbis", }, 44: { FormatExtensionKey: "webm", FormatResolutionKey: "480p", FormatVideoEncodingKey: "VP8", FormatProfileKey: nil, FormatAudioEncodingKey: "vorbis", }, 45: { FormatExtensionKey: "webm", FormatResolutionKey: "720p", FormatVideoEncodingKey: "VP8", FormatProfileKey: nil, FormatAudioEncodingKey: "vorbis", }, 46: { FormatExtensionKey: "webm", FormatResolutionKey: "1080p", FormatVideoEncodingKey: "VP8", FormatProfileKey: nil, FormatAudioEncodingKey: "vorbis", }, 82: { FormatExtensionKey: "mp4", FormatResolutionKey: "360p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "3d", }, 83: { FormatExtensionKey: "mp4", FormatResolutionKey: "240p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "3d", FormatAudioEncodingKey: "aac", }, 84: { FormatExtensionKey: "mp4", FormatResolutionKey: "720p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "3d", FormatAudioEncodingKey: "aac", }, 85: { FormatExtensionKey: "mp4", FormatResolutionKey: "1080p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "3d", FormatAudioEncodingKey: "aac", }, 100: { FormatExtensionKey: "webm", FormatResolutionKey: "360p", FormatVideoEncodingKey: "VP8", FormatProfileKey: "3d", FormatAudioEncodingKey: "vorbis", }, 101: { FormatExtensionKey: "webm", FormatResolutionKey: "360p", FormatVideoEncodingKey: "VP8", FormatProfileKey: "3d", FormatAudioEncodingKey: "vorbis", }, 102: { FormatExtensionKey: "webm", FormatResolutionKey: "720p", FormatVideoEncodingKey: "VP8", FormatProfileKey: "3d", FormatAudioEncodingKey: "vorbis", }, 133: { FormatExtensionKey: "mp4", FormatResolutionKey: "240p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "main", FormatAudioEncodingKey: nil, }, 134: { FormatExtensionKey: "mp4", FormatResolutionKey: "360p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "main", FormatAudioEncodingKey: nil, }, 135: { FormatExtensionKey: "mp4", FormatResolutionKey: "480p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "main", FormatAudioEncodingKey: nil, }, 136: { FormatExtensionKey: "mp4", FormatResolutionKey: "720p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "main", FormatAudioEncodingKey: nil, }, 137: { FormatExtensionKey: "mp4", FormatResolutionKey: "1080p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "high", FormatAudioEncodingKey: nil, }, 138: { FormatExtensionKey: "mp4", FormatResolutionKey: "2160p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "high", FormatAudioEncodingKey: nil, }, 160: { FormatExtensionKey: "mp4", FormatResolutionKey: "144p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "main", FormatAudioEncodingKey: nil, }, 242: { FormatExtensionKey: "webm", FormatResolutionKey: "240p", FormatVideoEncodingKey: "VP9", FormatProfileKey: nil, FormatAudioEncodingKey: nil, }, 243: { FormatExtensionKey: "webm", FormatResolutionKey: "360p", FormatVideoEncodingKey: "VP9", FormatProfileKey: nil, FormatAudioEncodingKey: nil, }, 244: { FormatExtensionKey: "webm", FormatResolutionKey: "480p", FormatVideoEncodingKey: "VP9", FormatProfileKey: nil, FormatAudioEncodingKey: nil, }, 247: { FormatExtensionKey: "webm", FormatResolutionKey: "720p", FormatVideoEncodingKey: "VP9", FormatProfileKey: nil, FormatAudioEncodingKey: nil, }, 248: { FormatExtensionKey: "webm", FormatResolutionKey: "1080p", FormatVideoEncodingKey: "VP9", FormatProfileKey: nil, FormatAudioEncodingKey: nil, }, 264: { FormatExtensionKey: "mp4", FormatResolutionKey: "1440p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "high", FormatAudioEncodingKey: nil, }, 266: { FormatExtensionKey: "mp4", FormatResolutionKey: "2160p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "high", FormatAudioEncodingKey: nil, }, 271: { FormatExtensionKey: "webm", FormatResolutionKey: "1440p", FormatVideoEncodingKey: "VP9", FormatProfileKey: nil, FormatAudioEncodingKey: nil, }, 272: { FormatExtensionKey: "webm", FormatResolutionKey: "2160p", FormatVideoEncodingKey: "VP9", FormatProfileKey: nil, FormatAudioEncodingKey: nil, }, 278: { FormatExtensionKey: "webm", FormatResolutionKey: "144p", FormatVideoEncodingKey: "VP9", FormatProfileKey: nil, FormatAudioEncodingKey: nil, }, 298: { FormatExtensionKey: "mp4", FormatResolutionKey: "720p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "main", FormatAudioEncodingKey: nil, }, 299: { FormatExtensionKey: "mp4", FormatResolutionKey: "1080p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "high", FormatAudioEncodingKey: nil, }, 302: { FormatExtensionKey: "webm", FormatResolutionKey: "720p", FormatVideoEncodingKey: "VP9", FormatProfileKey: nil, FormatAudioEncodingKey: nil, }, 303: { FormatExtensionKey: "webm", FormatResolutionKey: "1080p", FormatVideoEncodingKey: "VP9", FormatProfileKey: nil, FormatAudioEncodingKey: nil, }, 139: { FormatExtensionKey: "mp4", FormatResolutionKey: nil, FormatVideoEncodingKey: nil, FormatProfileKey: nil, FormatAudioEncodingKey: "aac", }, 140: { FormatExtensionKey: "mp4", FormatResolutionKey: nil, FormatVideoEncodingKey: nil, FormatProfileKey: nil, FormatAudioEncodingKey: "aac", }, 141: { FormatExtensionKey: "mp4", FormatResolutionKey: nil, FormatVideoEncodingKey: nil, FormatProfileKey: nil, FormatAudioEncodingKey: "aac", }, 171: { FormatExtensionKey: "webm", FormatResolutionKey: nil, FormatVideoEncodingKey: nil, FormatProfileKey: nil, FormatAudioEncodingKey: "vorbis", }, 172: { FormatExtensionKey: "webm", FormatResolutionKey: nil, FormatVideoEncodingKey: nil, FormatProfileKey: nil, FormatAudioEncodingKey: "vorbis", }, 249: { FormatExtensionKey: "webm", FormatResolutionKey: nil, FormatVideoEncodingKey: nil, FormatProfileKey: nil, FormatAudioEncodingKey: "opus", }, 250: { FormatExtensionKey: "webm", FormatResolutionKey: nil, FormatVideoEncodingKey: nil, FormatProfileKey: nil, FormatAudioEncodingKey: "opus", }, 251: { FormatExtensionKey: "webm", FormatResolutionKey: nil, FormatVideoEncodingKey: nil, FormatProfileKey: nil, FormatAudioEncodingKey: "opus", }, 92: { FormatExtensionKey: "ts", FormatResolutionKey: "240p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "main", FormatAudioEncodingKey: "aac", }, 93: { FormatExtensionKey: "ts", FormatResolutionKey: "480p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "main", FormatAudioEncodingKey: "aac", }, 94: { FormatExtensionKey: "ts", FormatResolutionKey: "720p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "main", FormatAudioEncodingKey: "aac", }, 95: { FormatExtensionKey: "ts", FormatResolutionKey: "1080p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "main", FormatAudioEncodingKey: "aac", }, 96: { FormatExtensionKey: "ts", FormatResolutionKey: "720p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "main", FormatAudioEncodingKey: "aac", }, 120: { FormatExtensionKey: "flv", FormatResolutionKey: "720p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "Main@L3.1", FormatAudioEncodingKey: "aac", }, 127: { FormatExtensionKey: "ts", FormatResolutionKey: nil, FormatVideoEncodingKey: nil, FormatProfileKey: nil, FormatAudioEncodingKey: "aac", }, 128: { FormatExtensionKey: "ts", FormatResolutionKey: nil, FormatVideoEncodingKey: nil, FormatProfileKey: nil, FormatAudioEncodingKey: "aac", }, 132: { FormatExtensionKey: "ts", FormatResolutionKey: "240p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "baseline", FormatAudioEncodingKey: "aac", }, 151: { FormatExtensionKey: "ts", FormatResolutionKey: "720p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "baseline", FormatAudioEncodingKey: "aac", }, }
FORMATS is a map of all itags and their formats
Functions ¶
This section is empty.
Types ¶
type Format ¶
type Format map[FormatKey]interface{}
Format is a map type for formats
func FilterFormats ¶
FilterFormats filters out all formats whose key doesn't contain any of values. Formats are ordered by values
type FormatKey ¶
type FormatKey string
FormatKey is a string type containg a key in a video format map
type Info ¶
type Info struct { // The video ID ID string `json:"id"` // The video title Title string `json:"title"` // The video description Description string `json:"description"` // The date the video was published DatePublished time.Time `json:"datePublished"` // Formats the video is available in Formats []Format `json:"formats"` // List of keywords associated with the video Keywords []string `json:"keywords"` // Author of the video Author string `json:"author"` // Duration of the video Duration time.Duration // contains filtered or unexported fields }
Info contains the info a youtube video
func GetInfoFromID ¶
GetInfoFromID fetches video info from a youtube video id
func GetInfoFromURL ¶
GetInfoFromURL fetches video info from a youtube url
func (*Info) GetDownloadURL ¶
GetDownloadURL gets the download url for a format
func (*Info) GetThumbnailURL ¶
func (info *Info) GetThumbnailURL(quality ThumbnailQuality) *url.URL
GetThumbnailURL returns a url for the thumbnail image with the given quality
type ThumbnailQuality ¶
type ThumbnailQuality string
ThumbnailQuality is a youtube thumbnail quality option
const ThumbnailQualityDefault ThumbnailQuality = "default"
ThumbnailQualityDefault is the default quality thumbnail jpg
const ThumbnailQualityHigh ThumbnailQuality = "hqdefault"
ThumbnailQualityHigh is the high quality thumbnail jpg
const ThumbnailQualityMaxRes ThumbnailQuality = "maxresdefault"
ThumbnailQualityMaxRes is the maximum resolution quality jpg
const ThumbnailQualityMedium ThumbnailQuality = "mqdefault"
ThumbnailQualityMedium is the medium quality thumbnail jpg
const ThumbnailQualitySD ThumbnailQuality = "sddefault"
ThumbnailQualitySD is the standard def quality thumbnail jpg