Package rakuten (v1.10.9) [up] [repository]

Index

Constants

const DeviceID = "atvui40"

DeviceID is the default identifier used for requests.

Variables

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",
}

Types

type AudioLanguage

type AudioLanguage struct {
	Id string `json:"id"`
}

type ContentType

ContentType defines the type of media.

type ContentType string

type Dash

type Dash struct {
	Body []byte
	Url  *url.URL
}

type Media

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
}

Methods

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).

type PlayerType

PlayerType defines the allowed player types/DRM schemes.

type PlayerType string

type SeasonData

type SeasonData struct {
	Episodes []VideoItem `json:"episodes"`
}

type Stream

type Stream struct {
	AudioLanguages []AudioLanguage `json:"audio_languages"`
}

type StreamData

type StreamData struct {
	StreamInfos []struct {
		LicenseUrl string `json:"license_url"`
		Url        string `json:"url"`
	} `json:"stream_infos"`
}

Methods

func (s StreamData) Dash() (*Dash, error)
func (s StreamData) Widevine(data []byte) ([]byte, error)

type StreamRequestPayload

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

type TvShowData struct {
	Seasons []struct {
		Id string `json:"id"`
	} `json:"seasons"`
}

Methods

func (t TvShowData) String() string

type VideoItem

type VideoItem struct {
	Title       string      `json:"title"`
	Id          string      `json:"id"`
	ViewOptions ViewOptions `json:"view_options"`
}

Methods

func (v *VideoItem) String() string

It returns the ID, Title, and a unique list of available audio languages.

type VideoQuality

VideoQuality defines the allowed video qualities for streaming.

type VideoQuality string

type ViewOptions

type ViewOptions struct {
	Private struct {
		Streams []Stream `json:"streams"`
	} `json:"private"`
}