crunchyroll

package
v0.0.0-...-84ff82d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2022 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// IVPlaceholder holds place for IV
	IVPlaceholder = []byte{0, 0, 0, 0, 0, 0, 0, 0}
)

Functions

func DecryptData

func DecryptData(c *http.Client, data []byte, v *Download, aes128Keys *map[string][]byte)

DecryptData decrypts the AES-128 encrypted data

func DownloadSegment

func DownloadSegment(c *http.Client, fn string, dlc chan *Download, recTime time.Duration)

DownloadSegment downloads the segment of the file

func DownloadStream

func DownloadStream(c *http.Client, auth AuthConfig, url string, resolution string, ep Episode, wg *sync.WaitGroup) error

DownloadStream downloads the given stream url

func GetPlaylist

func GetPlaylist(c *http.Client, urlStr string, recTime time.Duration, useLocalTime bool, dlc chan *Download, wg *sync.WaitGroup)

GetPlaylist gets the playlist data

func GetResolutions

func GetResolutions(c *http.Client, auth AuthConfig, url string, ep Episode) ([]string, error)

GetResolutions gets the resolutions for an episodeID

func GetStreamURL

func GetStreamURL(c *http.Client, auth AuthConfig, path string, locale string) (string, error)

GetStreamURL returns the stream url for the videoID and locale

Types

type AuthConfig

type AuthConfig struct {
	AccessToken string
	Policy      string
	Signature   string
	KeyPairID   string
	Bucket      string
}

AuthConfig stores information needed for authorized requests

type CMSInfo

type CMSInfo struct {
	Cms struct {
		Bucket    string    `json:"bucket"`
		Policy    string    `json:"policy"`
		Signature string    `json:"signature"`
		KeyPairID string    `json:"key_pair_id"`
		Expires   time.Time `json:"expires"`
	} `json:"cms"`
	ServiceAvailable bool `json:"service_available"`
}

CMSInfo holds CMS info for crunchyroll streaming

func GetCMS

func GetCMS(c *http.Client, token string) (CMSInfo, error)

GetCMS gets crunchyroll CMS info

type Credentials

type Credentials struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	ExpiresIn    int    `json:"expires_in"`
	TokenType    string `json:"token_type"`
	Scope        string `json:"scope"`
	Country      string `json:"country"`
}

Credentials holds crunchyroll oauth credientials

func Login

func Login(c *http.Client, user string, pass string) (Credentials, error)

Login creates a new crunchyroll session

type Download

type Download struct {
	URI     string
	SeqNo   uint64
	ExtXKey *m3u8.Key
	// contains filtered or unexported fields
}

Download holds information needed for downloading

type Episode

type Episode struct {
	Class       string `json:"__class__"`
	Href        string `json:"__href__"`
	ResourceKey string `json:"__resource_key__"`
	Links       struct {
		EpisodeChannel struct {
			Href string `json:"href"`
		} `json:"episode/channel"`
		EpisodeNextEpisode struct {
			Href string `json:"href"`
		} `json:"episode/next_episode"`
		EpisodeSeason struct {
			Href string `json:"href"`
		} `json:"episode/season"`
		EpisodeSeries struct {
			Href string `json:"href"`
		} `json:"episode/series"`
		Streams struct {
			Href string `json:"href"`
		} `json:"streams"`
	} `json:"__links__"`
	Actions struct {
	} `json:"__actions__"`
	ID                  string   `json:"id"`
	ChannelID           string   `json:"channel_id"`
	SeriesID            string   `json:"series_id"`
	SeriesTitle         string   `json:"series_title"`
	SeasonID            string   `json:"season_id"`
	SeasonTitle         string   `json:"season_title"`
	SeasonNumber        int      `json:"season_number"`
	Episode             string   `json:"episode"`
	EpisodeNumber       int      `json:"episode_number"`
	SequenceNumber      int      `json:"sequence_number"`
	ProductionEpisodeID string   `json:"production_episode_id"`
	Title               string   `json:"title"`
	Description         string   `json:"description"`
	NextEpisodeID       string   `json:"next_episode_id"`
	NextEpisodeTitle    string   `json:"next_episode_title"`
	HdFlag              bool     `json:"hd_flag"`
	IsMature            bool     `json:"is_mature"`
	MatureBlocked       bool     `json:"mature_blocked"`
	EpisodeAirDate      string   `json:"episode_air_date"`
	IsSubbed            bool     `json:"is_subbed"`
	IsDubbed            bool     `json:"is_dubbed"`
	IsClip              bool     `json:"is_clip"`
	SeoTitle            string   `json:"seo_title"`
	SeoDescription      string   `json:"seo_description"`
	SeasonTags          []string `json:"season_tags"`
	AvailableOffline    bool     `json:"available_offline"`
	MediaType           string   `json:"media_type"`
	Slug                string   `json:"slug"`
	Images              struct {
		Thumbnail [][]struct {
			Width  int    `json:"width"`
			Height int    `json:"height"`
			Type   string `json:"type"`
			Source string `json:"source"`
		} `json:"thumbnail"`
	} `json:"images"`
	DurationMs      int      `json:"duration_ms"`
	IsPremiumOnly   bool     `json:"is_premium_only"`
	ListingID       string   `json:"listing_id"`
	SubtitleLocales []string `json:"subtitle_locales"`
	Playback        string   `json:"playback"`
}

Episode contains stream information about the episode

func GetEpisode

func GetEpisode(c *http.Client, auth AuthConfig, videoID string) (Episode, error)

GetEpisode returns information about the episode

func GetEpisodes

func GetEpisodes(c *http.Client, auth AuthConfig, seasonID string) ([]Episode, error)

GetEpisodes returns a list of episodes for a given seasonID

type Season

type Season struct {
	common.Metadata
	Links struct {
		SeasonChannel struct {
			Href string `json:"href"`
		} `json:"season/channel"`
		SeasonEpisodes struct {
			Href string `json:"href"`
		} `json:"season/episodes"`
		SeasonSeries struct {
			Href string `json:"href"`
		} `json:"season/series"`
	} `json:"__links__"`
	Actions struct {
	} `json:"__actions__"`
	ID           string        `json:"id"`
	ChannelID    string        `json:"channel_id"`
	Title        string        `json:"title"`
	SeriesID     string        `json:"series_id"`
	SeasonNumber int           `json:"season_number"`
	IsComplete   bool          `json:"is_complete"`
	Description  string        `json:"description"`
	Keywords     []interface{} `json:"keywords"`
	SeasonTags   []string      `json:"season_tags"`
	Images       struct {
	} `json:"images"`
	IsMature       bool   `json:"is_mature"`
	MatureBlocked  bool   `json:"mature_blocked"`
	IsSubbed       bool   `json:"is_subbed"`
	IsDubbed       bool   `json:"is_dubbed"`
	IsSimulcast    bool   `json:"is_simulcast"`
	SeoTitle       string `json:"seo_title"`
	SeoDescription string `json:"seo_description"`
}

Season holds information about the series season

func GetSeasons

func GetSeasons(c *http.Client, auth AuthConfig, seriesID string) ([]Season, error)

GetSeasons gets the seasons information for the given seriesID

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL