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", FormatItagKey: 5, }, 6: { FormatExtensionKey: "flv", FormatResolutionKey: "270p", FormatVideoEncodingKey: "Sorenson H.263", FormatProfileKey: nil, FormatAudioEncodingKey: "mp3", FormatItagKey: 6, }, 13: { FormatExtensionKey: "3gp", FormatResolutionKey: nil, FormatVideoEncodingKey: "MPEG-4 Visual", FormatProfileKey: nil, FormatAudioEncodingKey: "aac", FormatItagKey: 13, }, 17: { FormatExtensionKey: "3gp", FormatResolutionKey: "144p", FormatVideoEncodingKey: "MPEG-4 Visual", FormatAudioEncodingKey: "aac", FormatProfileKey: nil, FormatItagKey: 17, }, 18: { FormatExtensionKey: "mp4", FormatResolutionKey: "360p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "baseline", FormatAudioEncodingKey: "aac", FormatItagKey: 18, }, 22: { FormatExtensionKey: "mp4", FormatResolutionKey: "720p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "high", FormatAudioEncodingKey: "aac", FormatItagKey: 22, }, 34: { FormatExtensionKey: "flv", FormatResolutionKey: "480p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "main", FormatAudioEncodingKey: "aac", FormatItagKey: 34, }, 35: { FormatExtensionKey: "flv", FormatResolutionKey: "360p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "main", FormatAudioEncodingKey: "aac", FormatItagKey: 35, }, 36: { FormatExtensionKey: "3gp", FormatResolutionKey: "240p", FormatVideoEncodingKey: "MPEG-4 Visual", FormatProfileKey: "simple", FormatAudioEncodingKey: "aac", FormatItagKey: 36, }, 37: { FormatExtensionKey: "mp4", FormatResolutionKey: "1080p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "high", FormatAudioEncodingKey: "aac", FormatItagKey: 37, }, 38: { FormatExtensionKey: "mp4", FormatResolutionKey: "3072p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "high", FormatAudioEncodingKey: "aac", FormatItagKey: 38, }, 43: { FormatExtensionKey: "webm", FormatResolutionKey: "360p", FormatVideoEncodingKey: "VP8", FormatProfileKey: nil, FormatAudioEncodingKey: "vorbis", FormatItagKey: 43, }, 44: { FormatExtensionKey: "webm", FormatResolutionKey: "480p", FormatVideoEncodingKey: "VP8", FormatProfileKey: nil, FormatAudioEncodingKey: "vorbis", FormatItagKey: 44, }, 45: { FormatExtensionKey: "webm", FormatResolutionKey: "720p", FormatVideoEncodingKey: "VP8", FormatProfileKey: nil, FormatAudioEncodingKey: "vorbis", FormatItagKey: 45, }, 46: { FormatExtensionKey: "webm", FormatResolutionKey: "1080p", FormatVideoEncodingKey: "VP8", FormatProfileKey: nil, FormatAudioEncodingKey: "vorbis", FormatItagKey: 46, }, 82: { FormatExtensionKey: "mp4", FormatResolutionKey: "360p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "3d", FormatItagKey: 82, }, 83: { FormatExtensionKey: "mp4", FormatResolutionKey: "240p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "3d", FormatAudioEncodingKey: "aac", FormatItagKey: 83, }, 84: { FormatExtensionKey: "mp4", FormatResolutionKey: "720p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "3d", FormatAudioEncodingKey: "aac", FormatItagKey: 84, }, 85: { FormatExtensionKey: "mp4", FormatResolutionKey: "1080p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "3d", FormatAudioEncodingKey: "aac", FormatItagKey: 85, }, 100: { FormatExtensionKey: "webm", FormatResolutionKey: "360p", FormatVideoEncodingKey: "VP8", FormatProfileKey: "3d", FormatAudioEncodingKey: "vorbis", FormatItagKey: 100, }, 101: { FormatExtensionKey: "webm", FormatResolutionKey: "360p", FormatVideoEncodingKey: "VP8", FormatProfileKey: "3d", FormatAudioEncodingKey: "vorbis", FormatItagKey: 101, }, 102: { FormatExtensionKey: "webm", FormatResolutionKey: "720p", FormatVideoEncodingKey: "VP8", FormatProfileKey: "3d", FormatAudioEncodingKey: "vorbis", FormatItagKey: 102, }, 133: { FormatExtensionKey: "mp4", FormatResolutionKey: "240p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "main", FormatAudioEncodingKey: nil, FormatItagKey: 133, }, 134: { FormatExtensionKey: "mp4", FormatResolutionKey: "360p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "main", FormatAudioEncodingKey: nil, FormatItagKey: 134, }, 135: { FormatExtensionKey: "mp4", FormatResolutionKey: "480p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "main", FormatAudioEncodingKey: nil, FormatItagKey: 135, }, 136: { FormatExtensionKey: "mp4", FormatResolutionKey: "720p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "main", FormatAudioEncodingKey: nil, FormatItagKey: 136, }, 137: { FormatExtensionKey: "mp4", FormatResolutionKey: "1080p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "high", FormatAudioEncodingKey: nil, FormatItagKey: 137, }, 138: { FormatExtensionKey: "mp4", FormatResolutionKey: "2160p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "high", FormatAudioEncodingKey: nil, FormatItagKey: 138, }, 160: { FormatExtensionKey: "mp4", FormatResolutionKey: "144p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "main", FormatAudioEncodingKey: nil, FormatItagKey: 160, }, 242: { FormatExtensionKey: "webm", FormatResolutionKey: "240p", FormatVideoEncodingKey: "VP9", FormatProfileKey: nil, FormatAudioEncodingKey: nil, FormatItagKey: 242, }, 243: { FormatExtensionKey: "webm", FormatResolutionKey: "360p", FormatVideoEncodingKey: "VP9", FormatProfileKey: nil, FormatAudioEncodingKey: nil, FormatItagKey: 243, }, 244: { FormatExtensionKey: "webm", FormatResolutionKey: "480p", FormatVideoEncodingKey: "VP9", FormatProfileKey: nil, FormatAudioEncodingKey: nil, FormatItagKey: 244, }, 247: { FormatExtensionKey: "webm", FormatResolutionKey: "720p", FormatVideoEncodingKey: "VP9", FormatProfileKey: nil, FormatAudioEncodingKey: nil, FormatItagKey: 247, }, 248: { FormatExtensionKey: "webm", FormatResolutionKey: "1080p", FormatVideoEncodingKey: "VP9", FormatProfileKey: nil, FormatAudioEncodingKey: nil, FormatItagKey: 248, }, 264: { FormatExtensionKey: "mp4", FormatResolutionKey: "1440p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "high", FormatAudioEncodingKey: nil, FormatItagKey: 264, }, 266: { FormatExtensionKey: "mp4", FormatResolutionKey: "2160p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "high", FormatAudioEncodingKey: nil, FormatItagKey: 266, }, 271: { FormatExtensionKey: "webm", FormatResolutionKey: "1440p", FormatVideoEncodingKey: "VP9", FormatProfileKey: nil, FormatAudioEncodingKey: nil, FormatItagKey: 271, }, 272: { FormatExtensionKey: "webm", FormatResolutionKey: "2160p", FormatVideoEncodingKey: "VP9", FormatProfileKey: nil, FormatAudioEncodingKey: nil, FormatItagKey: 272, }, 278: { FormatExtensionKey: "webm", FormatResolutionKey: "144p", FormatVideoEncodingKey: "VP9", FormatProfileKey: nil, FormatAudioEncodingKey: nil, FormatItagKey: 278, }, 298: { FormatExtensionKey: "mp4", FormatResolutionKey: "720p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "main", FormatAudioEncodingKey: nil, FormatItagKey: 298, }, 299: { FormatExtensionKey: "mp4", FormatResolutionKey: "1080p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "high", FormatAudioEncodingKey: nil, FormatItagKey: 299, }, 302: { FormatExtensionKey: "webm", FormatResolutionKey: "720p", FormatVideoEncodingKey: "VP9", FormatProfileKey: nil, FormatAudioEncodingKey: nil, FormatItagKey: 302, }, 303: { FormatExtensionKey: "webm", FormatResolutionKey: "1080p", FormatVideoEncodingKey: "VP9", FormatProfileKey: nil, FormatAudioEncodingKey: nil, FormatItagKey: 303, }, 139: { FormatExtensionKey: "mp4", FormatResolutionKey: nil, FormatVideoEncodingKey: nil, FormatProfileKey: nil, FormatAudioEncodingKey: "aac", FormatItagKey: 139, }, 140: { FormatExtensionKey: "mp4", FormatResolutionKey: nil, FormatVideoEncodingKey: nil, FormatProfileKey: nil, FormatAudioEncodingKey: "aac", FormatItagKey: 140, }, 141: { FormatExtensionKey: "mp4", FormatResolutionKey: nil, FormatVideoEncodingKey: nil, FormatProfileKey: nil, FormatAudioEncodingKey: "aac", FormatItagKey: 141, }, 171: { FormatExtensionKey: "webm", FormatResolutionKey: nil, FormatVideoEncodingKey: nil, FormatProfileKey: nil, FormatAudioEncodingKey: "vorbis", FormatItagKey: 171, }, 172: { FormatExtensionKey: "webm", FormatResolutionKey: nil, FormatVideoEncodingKey: nil, FormatProfileKey: nil, FormatAudioEncodingKey: "vorbis", FormatItagKey: 172, }, 249: { FormatExtensionKey: "webm", FormatResolutionKey: nil, FormatVideoEncodingKey: nil, FormatProfileKey: nil, FormatAudioEncodingKey: "opus", FormatItagKey: 249, }, 250: { FormatExtensionKey: "webm", FormatResolutionKey: nil, FormatVideoEncodingKey: nil, FormatProfileKey: nil, FormatAudioEncodingKey: "opus", FormatItagKey: 250, }, 251: { FormatExtensionKey: "webm", FormatResolutionKey: nil, FormatVideoEncodingKey: nil, FormatProfileKey: nil, FormatAudioEncodingKey: "opus", FormatItagKey: 251, }, 92: { FormatExtensionKey: "ts", FormatResolutionKey: "240p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "main", FormatAudioEncodingKey: "aac", FormatItagKey: 92, }, 93: { FormatExtensionKey: "ts", FormatResolutionKey: "480p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "main", FormatAudioEncodingKey: "aac", FormatItagKey: 93, }, 94: { FormatExtensionKey: "ts", FormatResolutionKey: "720p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "main", FormatAudioEncodingKey: "aac", FormatItagKey: 94, }, 95: { FormatExtensionKey: "ts", FormatResolutionKey: "1080p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "main", FormatAudioEncodingKey: "aac", FormatItagKey: 95, }, 96: { FormatExtensionKey: "ts", FormatResolutionKey: "720p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "main", FormatAudioEncodingKey: "aac", FormatItagKey: 96, }, 120: { FormatExtensionKey: "flv", FormatResolutionKey: "720p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "Main@L3.1", FormatAudioEncodingKey: "aac", FormatItagKey: 120, }, 127: { FormatExtensionKey: "ts", FormatResolutionKey: nil, FormatVideoEncodingKey: nil, FormatProfileKey: nil, FormatAudioEncodingKey: "aac", FormatItagKey: 127, }, 128: { FormatExtensionKey: "ts", FormatResolutionKey: nil, FormatVideoEncodingKey: nil, FormatProfileKey: nil, FormatAudioEncodingKey: "aac", FormatItagKey: 128, }, 132: { FormatExtensionKey: "ts", FormatResolutionKey: "240p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "baseline", FormatAudioEncodingKey: "aac", FormatItagKey: 132, }, 151: { FormatExtensionKey: "ts", FormatResolutionKey: "720p", FormatVideoEncodingKey: "H.264", FormatProfileKey: "baseline", FormatAudioEncodingKey: "aac", FormatItagKey: 151, }, }
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 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
type VideoInfo ¶ added in v0.3.0
type VideoInfo 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 }
VideoInfo contains the info a youtube video
func GetVideoInfo ¶ added in v0.3.0
GetVideoInfo fetches info from a url string, url object, or a url string
func GetVideoInfoFromID ¶ added in v0.3.0
GetVideoInfoFromID fetches video info from a youtube video id
func GetVideoInfoFromURL ¶ added in v0.3.0
GetVideoInfoFromURL fetches video info from a youtube url
func (*VideoInfo) Download ¶ added in v0.3.0
Download is a convenience method to download a format to an io.Writer
func (*VideoInfo) GetDownloadURL ¶ added in v0.3.0
GetDownloadURL gets the download url for a format
func (*VideoInfo) GetThumbnailURL ¶ added in v0.3.0
func (info *VideoInfo) GetThumbnailURL(quality ThumbnailQuality) *url.URL
GetThumbnailURL returns a url for the thumbnail image with the given quality