ytdl-web/pkg/ytdl/metadata/metadata.go

183 lines
5.6 KiB
Go
Raw Permalink Normal View History

2023-05-23 18:44:05 -04:00
package metadata
type Metadata struct {
Type string `json:"_type"`
// A list of videos in the playlist
Entries []Metadata
// Video identifier.
ID string `json:"id"`
// Video title, unescaped. Set to an empty string if video has
// no title as opposed to "None" which signifies that the
// extractor failed to obtain a title
Title *string `json:"title"`
// A list of dictionaries for each format available, ordered
// from worst to best quality.
Formats []Format `json:"formats"`
// Final video URL.
Url string `json:"url"`
// Video filename extension.
Ext string `json:"ext"`
// The video format, defaults to ext (used for --get-format)
Format string `json:"format"`
// True if a direct video file was given (must only be set by GenericIE)
Direct *bool `json:"direct"`
// A secondary title of the video.
AltTitle *string `json:"alt_title"`
// An alternative identifier for the video, not necessarily
// unique, but available before title. Typically, id is
// something like "4234987", title "Dancing naked mole rats",
// and display_id "dancing-naked-mole-rats"
DisplayID *string `json:"display_id"`
Thumbnails []Thumbnail `json:"thumbnails"`
// Full URL to a video thumbnail image.
Thumbnail *string `json:"thumbnail"`
// Full video description.
Description *string `json:"description"`
// Full name of the video uploader.
Uploader *string `json:"uploader"`
// License name the video is licensed under.
License *string `json:"license"`
// The creator of the video.
Creator *string `json:"creator"`
// UNIX timestamp of the moment the video was uploaded
Timestamp *float64 `json:"timestamp"`
// Video upload date in UTC (YYYYMMDD).
// If not explicitly set, calculated from timestamp
UploadDate *string `json:"upload_date"`
// UNIX timestamp of the moment the video was released.
// If it is not clear whether to use timestamp or this, use the former
ReleaseTimestamp *float64 `json:"release_timestamp"`
// The date (YYYYMMDD) when the video was released in UTC.
// If not explicitly set, calculated from release_timestamp
ReleaseDate *string `json:"release_date"`
// UNIX timestamp of the moment the video was last modified.
ModifiedTimestamp *float64 `json:"modified_timestamp"`
// The date (YYYYMMDD) when the video was last modified in UTC.
// If not explicitly set, calculated from modified_timestamp
ModifiedDate *string `json:"modified_date"`
// Nickname or id of the video uploader.
UploaderId *string `json:"uploader_id"`
// Full URL to a personal webpage of the video uploader.
UploaderUrl *string `json:"uploader_url"`
// Full name of the channel the video is uploaded on.
// Note that channel fields may or may not repeat uploader
// fields. This depends on a particular extractor.
Channel *string `json:"channel"`
// Id of the channel.
ChannelId *string `json:"channel_id"`
// Full URL to a channel webpage.
ChannelUrl *string `json:"channel_url"`
// Number of followers of the channel.
ChannelFollowerCount *int `json:"channel_follower_count"`
// Physical location where the video was filmed.
Location *string `json:"location"`
// The available subtitles as a dictionary in the format
// {tag: subformats}. "tag" is usually a language code, and
// "subformats" is a list sorted from lower to higher
// preference
Subtitles map[string][]Subtitle `json:"subtitles"`
// Like 'subtitles'; contains automatically generated
// captions instead of normal subtitles
AutomaticCaptions map[string][]Subtitle `json:"automatic_captions"`
// Length of the video in seconds, as an integer or float.
Duration *float64 `json:"duration"`
// How many users have watched the video on the platform.
ViewCount *int64 `json:"view_count"`
// How many users are currently watching the video on the platform.
ConcurrentViewCount *int64 `json:"concurrent_view_count"`
// Number of positive ratings of the video
LikeCount *int64 `json:"like_count"`
// Number of negative ratings of the video
DislikeCount *int64 `json:"dislike_count"`
// Number of reposts of the video
RepostCount *int64 `json:"repost_count"`
// Average rating give by users, the scale used depends on the webpage
AverageRating *float64 `json:"average_rating"`
// Number of comments on the video
CommentCount *int64 `json:"comment_count"`
// A list of comments
Comments []Comment `json:"comments"`
// Age restriction for the video, as an integer (years)
AgeLimit *int `json:"age_limit"`
// The URL to the video webpage, if given to yt-dlp it
// should allow to get the same result again. (It will be set
// by YoutubeDL if it's missing)
WebpageUrl *string `json:"webpage_url"`
// A list of categories that the video falls in
Categories []string `json:"categories"`
// A list of tags assigned to the video
Tags []string `json:"tags"`
// A list of the video cast
Cast []string `json:"cast"`
// Whether this video is a live stream that goes on instead of a fixed-length video.
IsLive *bool `json:"is_live"`
// Whether this video was originally a live stream.
WasLive *bool `json:"was_live"`
// None (=unknown), 'is_live', 'is_upcoming', 'was_live', 'not_live',
// or 'post_live' (was live, but VOD is not yet processed)
// If absent, automatically set from is_live, was_live
LiveStatus *string `json:"live_status"`
// Time in seconds where the reproduction should start, as
// specified in the URL.
StartTime *float64 `json:"start_time"`
// Time in seconds where the reproduction should end, as
// specified in the URL.
EndTime *float64 `json:"end_time"`
Chapters []Chapter `json:"chapters"`
}
2023-05-23 19:35:52 -04:00
func (m Metadata) IsPlaylist() bool {
return m.Type == "playlist"
}