Documentation ¶
Index ¶
- Constants
- func MatchEpisode(url string) (seriesName, title string, ok bool)deprecated
- func MatchVideo(url string) (seriesName string, ok bool)
- func ParseBetaEpisodeURL(url string) (episodeId string, ok bool)
- func ParseBetaSeriesURL(url string) (seasonId string, ok bool)
- func ParseEpisodeURL(url string) (seriesName, title string, episodeNumber int, webId int, ok bool)
- type AccessError
- type Crunchyroll
- type Episode
- type Format
- type FormatType
- type LOCALE
- type Movie
- type MovieListing
- type Season
- type Series
- type Stream
- type Subtitle
- type Video
Constants ¶
const ( JP LOCALE = "ja-JP" US = "en-US" LA = "es-LA" ES = "es-ES" FR = "fr-FR" BR = "pt-BR" IT = "it-IT" DE = "de-DE" RU = "ru-RU" ME = "ar-ME" )
Variables ¶
This section is empty.
Functions ¶
func MatchEpisode
deprecated
added in
v1.1.0
func MatchVideo ¶ added in v1.1.0
MatchVideo tries to extract the crunchyroll series / movie name out of the given url
func ParseBetaEpisodeURL ¶ added in v1.2.2
ParseBetaEpisodeURL tries to extract the episode id of the given crunchyroll beta url, pointing to an episode
func ParseBetaSeriesURL ¶ added in v1.2.2
ParseBetaSeriesURL tries to extract the season id of the given crunchyroll beta url, pointing to a season
func ParseEpisodeURL ¶ added in v1.2.1
ParseEpisodeURL tries to extract the crunchyroll series name, title, episode number and web id out of the given crunchyroll url Note that the episode number can be misleading. For example if an episode has the episode number 23.5 (slime isekai) the episode number will be 235
Types ¶
type AccessError ¶
type AccessError struct { URL string Body []byte Message string // contains filtered or unexported fields }
AccessError is an error which will be returned when some special sort of api request fails. See Crunchyroll.request when the error gets used
func (*AccessError) Error ¶
func (ae *AccessError) Error() string
type Crunchyroll ¶
type Crunchyroll struct { // Client is the http.Client to perform all requests over Client *http.Client // Locale specifies in which language all results should be returned / requested Locale LOCALE // SessionID is the crunchyroll session id which was used for authentication SessionID string // Config stores parameters which are needed by some api calls Config struct { TokenType string AccessToken string CountryCode string Premium bool Channel string Policy string Signature string KeyPairID string AccountID string ExternalID string MaturityRating string } }
func LoginWithCredentials ¶
func LoginWithCredentials(email string, password string, locale LOCALE, client *http.Client) (*Crunchyroll, error)
LoginWithCredentials logs in via crunchyroll email and password
func LoginWithSessionID ¶
LoginWithSessionID logs in via a crunchyroll session id. Session ids are automatically generated as a cookie when visiting https://www.crunchyroll.com
func (*Crunchyroll) FindEpisode ¶
func (c *Crunchyroll) FindEpisode(url string) ([]*Episode, error)
FindEpisode finds an episode by its crunchyroll link e.g. https://www.crunchyroll.com/darling-in-the-franxx/episode-1-alone-and-lonesome-759575
func (*Crunchyroll) FindVideo ¶
func (c *Crunchyroll) FindVideo(seriesUrl string) (Video, error)
FindVideo finds a Video (Season or Movie) by a crunchyroll link e.g. https://www.crunchyroll.com/darling-in-the-franxx
type Episode ¶
type Episode struct { ID string `json:"id"` SeriesID string `json:"series_id"` SeriesTitle string `json:"series_title"` SeasonNumber int `json:"season_number"` Episode string `json:"episode"` EpisodeNumber int `json:"episode_number"` SequenceNumber float64 `json:"sequence_number"` ProductionEpisodeID string `json:"production_episode_id"` Title string `json:"title"` SlugTitle string `json:"slug_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 time.Time `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"` 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 []LOCALE `json:"subtitle_locales"` Playback string `json:"playback"` AvailabilityNotes string `json:"availability_notes"` StreamID string // contains filtered or unexported fields }
func EpisodeFromID ¶
func EpisodeFromID(crunchy *Crunchyroll, id string) (*Episode, error)
EpisodeFromID returns an episode by its api id
func (*Episode) AudioLocale ¶
AudioLocale returns the audio locale of the episode. Every episode in a season (should) have the same audio locale, so if you want to get the audio locale of a season, just call this method on the first episode of the season. Otherwise, if you call this function on every episode it will cause a massive delay and redundant network overload since it calls an api endpoint every time
type Format ¶
type Format struct { ID string // FormatType represents if the format parent is an episode or a movie FormatType FormatType Video *m3u8.Variant AudioLocale LOCALE Hardsub LOCALE Subtitles []*Subtitle // contains filtered or unexported fields }
func (*Format) Download
deprecated
func (*Format) DownloadGoroutines ¶ added in v1.2.0
func (f *Format) DownloadGoroutines(output *os.File, goroutines int, onSegmentDownload func(segment *m3u8.MediaSegment, current, total int, file *os.File) error) error
DownloadGoroutines downloads the format to the given output file (as .ts file). See Format.DownloadSegments for more information
func (*Format) DownloadSegments ¶
func (f *Format) DownloadSegments(outputDir string, goroutines int, onSegmentDownload func(segment *m3u8.MediaSegment, current, total int, file *os.File) error) error
DownloadSegments downloads every mpeg transport stream segment to a given directory (more information below). After every segment download onSegmentDownload will be called with:
the downloaded segment, the current position, the total size of segments to download, the file where the segment content was written to an error (if occurred).
The filename is always <number of downloaded segment>.ts
Short explanation:
The actual crunchyroll video is split up in multiple segments (or video files) which have to be downloaded and merged after to generate a single video file. And this function just downloads each of this segment into the given directory. See https://en.wikipedia.org/wiki/MPEG_transport_stream for more information
type Movie ¶
type Movie struct { Video // not generated when calling MovieFromID MovieListingMetadata struct { AvailabilityNotes string `json:"availability_notes"` AvailableOffline bool `json:"available_offline"` DurationMS int `json:"duration_ms"` ExtendedDescription string `json:"extended_description"` FirstMovieID string `json:"first_movie_id"` IsDubbed bool `json:"is_dubbed"` IsMature bool `json:"is_mature"` IsPremiumOnly bool `json:"is_premium_only"` IsSubbed bool `json:"is_subbed"` MatureRatings []string `json:"mature_ratings"` MovieReleaseYear int `json:"movie_release_year"` SubtitleLocales []LOCALE `json:"subtitle_locales"` } `json:"movie_listing_metadata"` Playback string `json:"playback"` PromoDescription string `json:"promo_description"` PromoTitle string `json:"promo_title"` SearchMetadata struct { Score float64 `json:"score"` } // contains filtered or unexported fields }
func MovieFromID ¶
func MovieFromID(crunchy *Crunchyroll, id string) (*Movie, error)
MovieFromID returns a movie by its api id
func (*Movie) MovieListing ¶
func (m *Movie) MovieListing() (movieListings []*MovieListing, err error)
MovieListing returns all videos corresponding with the movie. Beside the normal movie, sometimes movie previews are returned too, but you can try to get the actual movie by sorting the returning MovieListing slice with the utils.MovieListingByDuration interface
type MovieListing ¶
type MovieListing struct { ID string `json:"id"` Title string `json:"title"` Slug string `json:"slug"` SlugTitle string `json:"slug_title"` Description string `json:"description"` 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"` ListeningID string `json:"listening_id"` IsMature bool `json:"is_mature"` AvailableOffline bool `json:"available_offline"` IsSubbed bool `json:"is_subbed"` IsDubbed bool `json:"is_dubbed"` Playback string `json:"playback"` AvailabilityNotes string `json:"availability_notes"` // contains filtered or unexported fields }
func MovieListingFromID ¶
func MovieListingFromID(crunchy *Crunchyroll, id string) (*MovieListing, error)
MovieListingFromID returns a movie listing by its api id
func (*MovieListing) AudioLocale ¶
func (ml *MovieListing) AudioLocale() (LOCALE, error)
AudioLocale is same as Episode.AudioLocale
func (*MovieListing) Streams ¶
func (ml *MovieListing) Streams() ([]*Stream, error)
Streams returns all streams which are available for the movie listing
type Season ¶
type Season struct { ID string `json:"id"` Title string `json:"title"` SlugTitle string `json:"slug_title"` SeriesID string `json:"series_id"` SeasonNumber int `json:"season_number"` IsComplete bool `json:"is_complete"` Description string `json:"description"` Keywords []string `json:"keywords"` SeasonTags []string `json:"season_tags"` 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"` Language LOCALE // contains filtered or unexported fields }
func SeasonFromID ¶
func SeasonFromID(crunchy *Crunchyroll, id string) (*Season, error)
SeasonFromID returns a season by its api id
type Series ¶
type Series struct { Video PromoDescription string `json:"promo_description"` PromoTitle string `json:"promo_title"` AvailabilityNotes string `json:"availability_notes"` EpisodeCount int `json:"episode_count"` ExtendedDescription string `json:"extended_description"` IsDubbed bool `json:"is_dubbed"` IsMature bool `json:"is_mature"` IsSimulcast bool `json:"is_simulcast"` IsSubbed bool `json:"is_subbed"` MatureBlocked bool `json:"mature_blocked"` MatureRatings []string `json:"mature_ratings"` SeasonCount int `json:"season_count"` // not generated when calling SeriesFromID SearchMetadata struct { Score float64 `json:"score"` } // contains filtered or unexported fields }
func SeriesFromID ¶
func SeriesFromID(crunchy *Crunchyroll, id string) (*Series, error)
SeriesFromID returns a series by its api id
type Stream ¶
type Stream struct { HardsubLocale LOCALE AudioLocale LOCALE Subtitles []*Subtitle // contains filtered or unexported fields }
func StreamsFromID ¶
func StreamsFromID(crunchy *Crunchyroll, id string) ([]*Stream, error)
StreamsFromID returns a stream by its api id