const DeviceID = "atvui40"
DeviceID is the default identifier used for requests.
var Player = struct { PlayReady PlayerType Widevine PlayerType }{ PlayReady: DeviceID + ":DASH-CENC:PR", Widevine: DeviceID + ":DASH-CENC:WVM", }
var Quality = struct { FHD VideoQuality HD VideoQuality }{ FHD: "FHD", HD: "HD", }
type AudioLanguage struct { Id string `json:"id"` }
ContentType defines the type of media.
type ContentType string
type Dash struct { Body []byte Url *url.URL }
Media represents a piece of content, which can be a Movie or a TV Show.
type Media struct { Id string // Matches "content_id" or "tv_show_id" in URLs MarketCode string Type ContentType }
func (m *Media) EpisodeStream(episodeId, audioLanguage string, player PlayerType, quality VideoQuality) (*StreamData, error)
EpisodeStream requests the stream for a specific TV Show Episode (POST).
func (m *Media) MovieStream(audioLanguage string, player PlayerType, quality VideoQuality) (*StreamData, error)
MovieStream requests the stream for this movie (POST). The movie's own ID is used as the contentId.
func (m *Media) ParseURL(rawLink string) error
ParseURL attempts to parse a URL and populate the Media struct.
func (m *Media) RequestMovie() (*VideoItem, error)
RequestMovie fetches movie details (GET).
func (m *Media) RequestSeason(seasonId string) (*SeasonData, error)
RequestSeason fetches episodes for a specific season (GET). This method is only applicable to TV Shows.
func (m *Media) RequestTvShow() (*TvShowData, error)
RequestTvShow fetches TV show details like seasons (GET).
PlayerType defines the allowed player types/DRM schemes.
type PlayerType string
type SeasonData struct { Episodes []VideoItem `json:"episodes"` }
type Stream struct { AudioLanguages []AudioLanguage `json:"audio_languages"` }
type StreamData struct { StreamInfos []struct { LicenseUrl string `json:"license_url"` Url string `json:"url"` } `json:"stream_infos"` }
func (s StreamData) Dash() (*Dash, error)
func (s StreamData) Widevine(data []byte) ([]byte, error)
type StreamRequestPayload struct { AudioQuality string `json:"audio_quality"` DeviceIdentifier string `json:"device_identifier"` DeviceSerial string `json:"device_serial"` SubtitleLanguage string `json:"subtitle_language"` VideoType string `json:"video_type"` Player PlayerType `json:"player"` ClassificationId int `json:"classification_id"` ContentType string `json:"content_type"` DeviceStreamVideoQuality VideoQuality `json:"device_stream_video_quality"` AudioLanguage string `json:"audio_language"` ContentId string `json:"content_id"` }
type TvShowData struct { Seasons []struct { Id string `json:"id"` } `json:"seasons"` }
func (t TvShowData) String() string
type VideoItem struct { Title string `json:"title"` Id string `json:"id"` ViewOptions ViewOptions `json:"view_options"` }
func (v *VideoItem) String() string
It returns the ID, Title, and a unique list of available audio languages.
VideoQuality defines the allowed video qualities for streaming.
type VideoQuality string
type ViewOptions struct { Private struct { Streams []Stream `json:"streams"` } `json:"private"` }