tstor/pkg/ytdlp/model.go

166 lines
5.7 KiB
Go
Raw Normal View History

2024-05-13 16:56:20 +00:00
package ytdlp
type PlaylistEntry struct {
ID string `json:"id"`
Uploader string `json:"uploader"`
UploaderID string `json:"uploader_id"`
UploadDate string `json:"upload_date"`
Title string `json:"title"`
Thumbnail string `json:"thumbnail"`
Duration int64 `json:"duration"`
LikeCount int64 `json:"like_count"`
DislikeCount int64 `json:"dislike_count"`
CommentCount int64 `json:"comment_count"`
Formats []Format `json:"formats"`
AgeLimit int64 `json:"age_limit"`
Tags []string `json:"tags"`
Categories []string `json:"categories"`
Cast []any `json:"cast"`
Subtitles Subtitles `json:"subtitles"`
Thumbnails []Thumbnail `json:"thumbnails"`
Timestamp int64 `json:"timestamp"`
ViewCount int64 `json:"view_count"`
WebpageURL string `json:"webpage_url"`
OriginalURL string `json:"original_url"`
WebpageURLBasename string `json:"webpage_url_basename"`
WebpageURLDomain string `json:"webpage_url_domain"`
Extractor string `json:"extractor"`
ExtractorKey string `json:"extractor_key"`
PlaylistCount int64 `json:"playlist_count"`
Playlist string `json:"playlist"`
PlaylistID string `json:"playlist_id"`
PlaylistTitle string `json:"playlist_title"`
PlaylistUploader string `json:"playlist_uploader"`
PlaylistUploaderID string `json:"playlist_uploader_id"`
NEntries int64 `json:"n_entries"`
PlaylistIndex int64 `json:"playlist_index"`
PlaylistAutonumber int64 `json:"playlist_autonumber"`
DisplayID string `json:"display_id"`
Fulltitle string `json:"fulltitle"`
DurationString string `json:"duration_string"`
ReleaseYear int `json:"release_year"`
Epoch int64 `json:"epoch"`
FormatID string `json:"format_id"`
URL string `json:"url"`
ManifestURL string `json:"manifest_url"`
Tbr float64 `json:"tbr"`
EXT EXT `json:"ext"`
FPS float64 `json:"fps"`
Protocol Protocol `json:"protocol"`
VideoHasDRM bool `json:"has_drm"`
Width int64 `json:"width"`
Height int64 `json:"height"`
Vcodec string `json:"vcodec"`
Acodec string `json:"acodec"`
DynamicRange DynamicRange `json:"dynamic_range"`
Resolution string `json:"resolution"`
AspectRatio float64 `json:"aspect_ratio"`
HTTPHeaders HTTPHeaders `json:"http_headers"`
VideoEXT EXT `json:"video_ext"`
AudioEXT AudioEXT `json:"audio_ext"`
Format string `json:"format"`
Filename string `json:"_filename"`
VideoFilename string `json:"filename"`
Type string `json:"_type"`
Version Version `json:"_version"`
}
// Progress implements ctxprogress.Progress.
func (p PlaylistEntry) Progress() (current int, total int) {
return int(p.PlaylistIndex), int(p.PlaylistCount)
}
type Format struct {
URL string `json:"url"`
FormatID string `json:"format_id"`
Height int64 `json:"height"`
EXT EXT `json:"ext"`
Protocol Protocol `json:"protocol"`
Resolution string `json:"resolution"`
DynamicRange DynamicRange `json:"dynamic_range"`
AspectRatio *float64 `json:"aspect_ratio"`
FilesizeApprox any `json:"filesize_approx"`
HTTPHeaders HTTPHeaders `json:"http_headers"`
VideoEXT EXT `json:"video_ext"`
AudioEXT AudioEXT `json:"audio_ext"`
Vbr any `json:"vbr"`
ABR any `json:"abr"`
Tbr *float64 `json:"tbr"`
Format string `json:"format"`
FormatIndex any `json:"format_index"`
ManifestURL *string `json:"manifest_url,omitempty"`
FPS *float64 `json:"fps,omitempty"`
Preference any `json:"preference"`
Quality any `json:"quality"`
HasDRM *bool `json:"has_drm,omitempty"`
Width *int64 `json:"width,omitempty"`
Vcodec *string `json:"vcodec,omitempty"`
Acodec *string `json:"acodec,omitempty"`
}
type HTTPHeaders struct {
UserAgent string `json:"User-Agent"`
Accept Accept `json:"Accept"`
AcceptLanguage AcceptLanguage `json:"Accept-Language"`
SECFetchMode SECFetchMode `json:"Sec-Fetch-Mode"`
}
type Subtitles struct {
}
type Thumbnail struct {
URL string `json:"url"`
ID string `json:"id"`
}
type Version struct {
Version string `json:"version"`
CurrentGitHead string `json:"current_git_head"`
ReleaseGitHead string `json:"release_git_head"`
Repository string `json:"repository"`
}
type AudioEXT string
const (
None AudioEXT = "none"
)
type DynamicRange string
const (
SDR DynamicRange = "SDR"
HDR DynamicRange = "HDR"
)
type EXT string
const (
Mp4 EXT = "mp4"
)
type Accept string
const (
TextHTMLApplicationXHTMLXMLApplicationXMLQ09Q08 Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
)
type AcceptLanguage string
const (
EnUsEnQ05 AcceptLanguage = "en-us,en;q=0.5"
)
type SECFetchMode string
const (
Navigate SECFetchMode = "navigate"
)
type Protocol string
const (
HTTPS Protocol = "https"
M3U8Native Protocol = "m3u8_native"
)