Documentation ΒΆ
Index ΒΆ
- Constants
- func ParseEpisodeURL(url string) (episodeId string, ok bool)
- func ParseSeriesURL(url string) (seasonId string, ok bool)
- type Account
- func (a *Account) AvailableWallpapers() (w []*Wallpaper, err error)
- func (a *Account) ChangeEmail(currentPassword, newEmail string) error
- func (a *Account) ChangePassword(currentPassword, newPassword string) error
- func (a *Account) ChangeWallpaper(wallpaper *Wallpaper) error
- func (a *Account) UpdateMatureMangaContent(enabled bool) error
- func (a *Account) UpdateMatureVideoContent(enabled bool) error
- func (a *Account) UpdatePreferredEmailLanguage(language LOCALE) error
- func (a *Account) UpdatePreferredVideoSubtitleLanguage(language LOCALE) error
- type BrowseOptions
- type BrowseSortType
- type BulkResult
- type Category
- type Comment
- func (c *Comment) Delete() error
- func (c *Comment) FlagAsSpoiler() error
- func (c *Comment) IsFlaggedAsSpoiler() bool
- func (c *Comment) IsReported() bool
- func (c *Comment) IsSpoiler() bool
- func (c *Comment) Like() error
- func (c *Comment) Liked() bool
- func (c *Comment) MarkAsSpoiler() error
- func (c *Comment) RemoveLike() error
- func (c *Comment) RemoveReport() error
- func (c *Comment) Replies(page uint, size uint) ([]*Comment, error)
- func (c *Comment) Reply(message string, spoiler bool) (*Comment, error)
- func (c *Comment) Report() error
- func (c *Comment) UnflagAsSpoiler() error
- func (c *Comment) UnmarkAsSpoiler() error
- type CommentsOptions
- type CommentsOrderType
- type CommentsSortType
- type Crunchylist
- func (cl *Crunchylist) AddSeries(series *Series) error
- func (cl *Crunchylist) AddSeriesFromID(id string) error
- func (cl *Crunchylist) Delete() error
- func (cl *Crunchylist) RemoveSeries(series *Series) error
- func (cl *Crunchylist) RemoveSeriesFromID(id string) error
- func (cl *Crunchylist) Rename(name string) error
- type CrunchylistItem
- type CrunchylistPreview
- type Crunchylists
- type Crunchyroll
- func LoginWithCredentials(user string, password string, locale LOCALE, client *http.Client) (*Crunchyroll, error)
- func LoginWithRefreshToken(refreshToken string, locale LOCALE, client *http.Client) (*Crunchyroll, error)
- func LoginWithSessionID(sessionID string, locale LOCALE, client *http.Client) (*Crunchyroll, error)deprecated
- func (c *Crunchyroll) Account() (*Account, error)
- func (c *Crunchyroll) Browse(options BrowseOptions, limit uint) (s []*Series, m []*Movie, err error)
- func (c *Crunchyroll) Categories(includeSubcategories bool) (ca []*Category, err error)
- func (c *Crunchyroll) Crunchylists() (*Crunchylists, error)
- func (c *Crunchyroll) ExtractEpisodesFromUrl(url string, audio ...LOCALE) ([]*Episode, error)
- func (c *Crunchyroll) FindEpisodeByName(seriesName, episodeTitle string) ([]*Episode, error)
- func (c *Crunchyroll) FindVideoByName(seriesName string) (Video, error)deprecated
- func (c *Crunchyroll) InvalidateSession() error
- func (c *Crunchyroll) IsCaching() bool
- func (c *Crunchyroll) News(topLimit uint, latestLimit uint) (t []*News, l []*News, err error)
- func (c *Crunchyroll) ParseUrl(url string) (*Series, []*Episode, error)
- func (c *Crunchyroll) Recommendations(limit uint) (s []*Series, m []*Movie, err error)
- func (c *Crunchyroll) Search(query string, limit uint) (s []*Series, m []*Movie, err error)
- func (c *Crunchyroll) SetCaching(caching bool)
- func (c *Crunchyroll) Simulcasts() (s []*Simulcast, err error)
- func (c *Crunchyroll) UpNext(limit uint) (e []*Episode, err error)
- func (c *Crunchyroll) WatchHistory(page uint, size uint) (e []*HistoryEpisode, err error)
- func (c *Crunchyroll) Watchlist(options WatchlistOptions, limit uint) ([]*WatchlistEntry, error)
- type Downloader
- type Episode
- func (e *Episode) AddToWatchlist() error
- func (e *Episode) AudioLocale() (LOCALE, error)
- func (e *Episode) Available() bool
- func (e *Episode) Comment(message string, spoiler bool) (*Comment, error)
- func (e *Episode) Comments(options CommentsOptions, page uint, size uint) (c []*Comment, err error)
- func (e *Episode) GetFormat(resolution string, subtitle LOCALE, hardsub bool) (*Format, error)
- func (e *Episode) RemoveFromWatchlist() error
- func (e *Episode) Streams() ([]*Stream, error)
- type Format
- type FormatType
- type HistoryEpisode
- type Image
- type LOCALE
- type MediaType
- type Movie
- type MovieListing
- type News
- type OwnerReview
- type Panel
- type Rating
- type RequestError
- type Review
- type ReviewOptions
- type ReviewRating
- type ReviewSortType
- type Season
- type Series
- func (s *Series) AddToWatchlist() error
- func (s *Series) CreateReview(title, content string, spoiler bool) (*OwnerReview, error)
- func (s *Series) GetOwnerReview() (*OwnerReview, error)
- func (s *Series) HasOwnerReview() bool
- func (s *Series) Rate(rating ReviewRating) error
- func (s *Series) Rating() (*Rating, error)
- func (s *Series) RemoveFromWatchlist() error
- func (s *Series) Reviews(options ReviewOptions, page uint, size uint) (BulkResult[*UserReview], error)
- func (s *Series) Seasons() (seasons []*Season, err error)
- func (s *Series) Similar(limit uint) (ss []*Series, m []*Movie, err error)
- type Simulcast
- type Stream
- type Subtitle
- type UserReview
- type Video
- type Wallpaper
- type WatchlistEntry
- type WatchlistEntryType
- type WatchlistLanguageType
- type WatchlistOptions
- type WatchlistOrderType
Constants ΒΆ
const ( JP LOCALE = "ja-JP" US = "en-US" LA = "es-419" LA2 = "es-LA" ES = "es-ES" FR = "fr-FR" PT = "pt-PT" BR = "pt-BR" IT = "it-IT" DE = "de-DE" RU = "ru-RU" AR = "ar-SA" ME = "ar-ME" CN = "zh-CN" )
const ( WatchlistEntryEpisode = "episode" WatchlistEntrySeries = "series" )
const ( OneStar ReviewRating = "s1" TwoStars = "s2" ThreeStars = "s3" FourStars = "s4" FiveStars = "s5" )
const ( BrowseSortPopularity BrowseSortType = "popularity" BrowseSortNewlyAdded = "newly_added" BrowseSortAlphabetical = "alphabetical" )
const ( ReviewSortNewest ReviewSortType = "newest" ReviewSortOldest = "oldest" ReviewSortHelpful = "helpful" )
const ( WatchlistOrderAsc = "asc" WatchlistOrderDesc = "desc" )
Variables ΒΆ
This section is empty.
Functions ΒΆ
func ParseEpisodeURL ΒΆ
ParseEpisodeURL tries to extract the episode id of the given crunchyroll url, pointing to an episode.
func ParseSeriesURL ΒΆ added in v3.0.4
ParseSeriesURL tries to extract the season id of the given crunchyroll url, pointing to a season.
Types ΒΆ
type Account ΒΆ
type Account struct { AccountID string `json:"account_id"` ExternalID string `json:"external_id"` EmailVerified bool `json:"email_verified"` Created time.Time `json:"created"` Avatar string `json:"avatar"` CrBetaOptIn bool `json:"cr_beta_opt_in"` Email string `json:"email"` MatureContentFlagManga string `json:"mature_content_flag_manga"` MaturityRating string `json:"maturity_rating"` OptOutAndroidInAppMarketing bool `json:"opt_out_android_in_app_marketing"` OptOutFreeTrials bool `json:"opt_out_free_trials"` OptOutNewMediaQueueUpdates bool `json:"opt_out_new_media_queue_updates"` OptOutNewsletters bool `json:"opt_out_newsletters"` OptOutPmUpdates bool `json:"opt_out_pm_updates"` OptOutPromotionalUpdates bool `json:"opt_out_promotional_updates"` OptOutQueueUpdates bool `json:"opt_out_queue_updates"` OptOutStoreDeals bool `json:"opt_out_store_deals"` PreferredCommunicationLanguage LOCALE `json:"preferred_communication_language"` PreferredContentSubtitleLanguage LOCALE `json:"preferred_content_subtitle_language"` QaUser bool `json:"qa_user"` Username string `json:"username"` Wallpaper *Wallpaper `json:"wallpaper"` // contains filtered or unexported fields }
Account contains information about a crunchyroll account.
func (*Account) AvailableWallpapers ΒΆ
AvailableWallpapers returns all available wallpapers which can be set as profile wallpaper.
func (*Account) ChangeEmail ΒΆ
ChangeEmail changes the email address for the current account.
func (*Account) ChangePassword ΒΆ
ChangePassword changes the password for the current account.
func (*Account) ChangeWallpaper ΒΆ
ChangeWallpaper changes the profile wallpaper of the current user. Use AvailableWallpapers to get all available ones.
func (*Account) UpdateMatureMangaContent ΒΆ
UpdateMatureMangaContent sets if mature manga content / 18+ content should be shown
func (*Account) UpdateMatureVideoContent ΒΆ
UpdateMatureVideoContent sets if mature video content / 18+ content should be shown
func (*Account) UpdatePreferredEmailLanguage ΒΆ
UpdatePreferredEmailLanguage sets in which language emails should be received.
func (*Account) UpdatePreferredVideoSubtitleLanguage ΒΆ
UpdatePreferredVideoSubtitleLanguage sets in which language default subtitles should be shown
type BrowseOptions ΒΆ
type BrowseOptions struct { // Categories specifies the categories of the entries. Categories []string `param:"categories"` // IsDubbed specifies whether the entries should be dubbed. IsDubbed bool `param:"is_dubbed"` // IsSubbed specifies whether the entries should be subbed. IsSubbed bool `param:"is_subbed"` // Simulcast specifies a particular simulcast season by id in which the entries have been aired. Simulcast string `param:"season_tag"` // Sort specifies how the entries should be sorted. Sort BrowseSortType `param:"sort_by"` // Start specifies the index from which the entries should be returned. Start uint `param:"start"` // Type specifies the media type of the entries. Type MediaType `param:"type"` }
BrowseOptions represents options for browsing the crunchyroll catalog.
type BrowseSortType ΒΆ
type BrowseSortType string
BrowseSortType represents a sort type to sort Crunchyroll.Browse items after.
type BulkResult ΒΆ
type Category ΒΆ
type Category struct { Category string `json:"tenant_category"` SubCategories []struct { Category string `json:"tenant_category"` ParentCategory string `json:"parent_category"` Localization struct { Title string `json:"title"` Description string `json:"description"` Locale LOCALE `json:"locale"` } `json:"localization"` Slug string `json:"slug"` } `json:"sub_categories"` Images struct { Background []Image `json:"background"` Low []Image `json:"low"` } `json:"images"` Localization struct { Title string `json:"title"` Description string `json:"description"` Locale LOCALE `json:"locale"` } `json:"localization"` Slug string `json:"slug"` }
Category contains all information about a category.
type Comment ΒΆ
type Comment struct { EpisodeID string `json:"episode_id"` CommentID string `json:"comment_id"` DomainID string `json:"domain_id"` GuestbookKey string `json:"guestbook_key"` User struct { UserKey string `json:"user_key"` UserAttributes struct { Username string `json:"username"` Avatar struct { Locked []Image `json:"locked"` Unlocked []Image `json:"unlocked"` } `json:"avatar"` } `json:"user_attributes"` UserFlags []any `json:"user_flags"` } `json:"user"` Message string `json:"message"` ParentCommentID int `json:"parent_comment_id"` Locale LOCALE `json:"locale"` UserVotes []string `json:"user_votes"` Flags []string `json:"flags"` Votes struct { Inappropriate int `json:"inappropriate"` Like int `json:"like"` Spoiler int `json:"spoiler"` } `json:"votes"` DeleteReason any `json:"delete_reason"` Created time.Time `json:"created"` Modified time.Time `json:"modified"` IsOwner bool `json:"is_owner"` RepliesCount int `json:"replies_count"` // contains filtered or unexported fields }
Comment contains all information about a comment.
func (*Comment) Delete ΒΆ
Delete deleted the current comment. Works only if the user has written the comment.
func (*Comment) FlagAsSpoiler ΒΆ
FlagAsSpoiler sends a request to the user (and / or crunchyroll?) to mark the comment as spoiler. Only works if the comment hasn't been flagged as spoiler yet.
func (*Comment) IsFlaggedAsSpoiler ΒΆ
func (*Comment) IsReported ΒΆ
func (*Comment) MarkAsSpoiler ΒΆ
MarkAsSpoiler marks the current comment as spoiler. Works only if the user has written the comment, and it isn't already marked as spoiler.
func (*Comment) RemoveLike ΒΆ
RemoveLike removes the like from the comment. Works only if the user has liked it.
func (*Comment) RemoveReport ΒΆ
RemoveReport removes the report request from the comment. Only works if the user has reported the comment.
func (*Comment) Report ΒΆ
Report reports the comment. Only works if the comment hasn't been reported yet.
func (*Comment) UnflagAsSpoiler ΒΆ
UnflagAsSpoiler rewokes the request to the user (and / or crunchyroll?) to mark the comment as spoiler. Only works if the user has flagged the comment as spoiler.
func (*Comment) UnmarkAsSpoiler ΒΆ
UnmarkAsSpoiler unmarks the current comment as spoiler. Works only if the user has written the comment, and it is already marked as spoiler.
type CommentsOptions ΒΆ
type CommentsOptions struct { // Order specified the order how the comments should be returned. Order CommentsOrderType `json:"order"` // Sort specified after which key the comments should be sorted. Sort CommentsSortType `json:"sort"` }
type CommentsOrderType ΒΆ
type CommentsOrderType string
CommentsOrderType represents a sort type to sort Episode.Comments after.
const ( CommentsOrderAsc CommentsOrderType = "asc" CommentsOrderDesc = "desc" )
type CommentsSortType ΒΆ
type CommentsSortType string
CommentsSortType specified after which factor Episode.Comments should be sorted.
const ( CommentsSortPopular CommentsSortType = "popular" CommentsSortDate = "date" )
type Crunchylist ΒΆ
type Crunchylist struct { ID string `json:"id"` Max int `json:"max"` Total int `json:"total"` Title string `json:"title"` IsPublic bool `json:"is_public"` ModifiedAt time.Time `json:"modified_at"` Items []*CrunchylistItem `json:"items"` // contains filtered or unexported fields }
Crunchylist contains information about a crunchylist.
func (*Crunchylist) AddSeries ΒΆ
func (cl *Crunchylist) AddSeries(series *Series) error
AddSeries adds a series.
func (*Crunchylist) AddSeriesFromID ΒΆ
func (cl *Crunchylist) AddSeriesFromID(id string) error
AddSeriesFromID adds a series from its id
func (*Crunchylist) Delete ΒΆ
func (cl *Crunchylist) Delete() error
Delete deleted the current crunchylist.
func (*Crunchylist) RemoveSeries ΒΆ
func (cl *Crunchylist) RemoveSeries(series *Series) error
RemoveSeries removes a series
func (*Crunchylist) RemoveSeriesFromID ΒΆ
func (cl *Crunchylist) RemoveSeriesFromID(id string) error
RemoveSeriesFromID removes a series by its id
func (*Crunchylist) Rename ΒΆ
func (cl *Crunchylist) Rename(name string) error
Rename renames the current crunchylist.
type CrunchylistItem ΒΆ
type CrunchylistItem struct { ListID string `json:"list_id"` ID string `json:"id"` ModifiedAt time.Time `json:"modified_at"` Panel Panel `json:"panel"` // contains filtered or unexported fields }
CrunchylistItem represents a series, saved in Crunchylist.
func (*CrunchylistItem) Remove ΒΆ
func (cli *CrunchylistItem) Remove() error
Remove removes the current item from its crunchylist.
type CrunchylistPreview ΒΆ
type CrunchylistPreview struct { ListID string `json:"list_id"` IsPublic bool `json:"is_public"` Total int `json:"total"` ModifiedAt time.Time `json:"modified_at"` Title string `json:"title"` // contains filtered or unexported fields }
CrunchylistPreview is a preview to Crunchylist.
func (*CrunchylistPreview) Crunchylist ΒΆ
func (clp *CrunchylistPreview) Crunchylist() (*Crunchylist, error)
Crunchylist returns the belonging Crunchylist struct.
type Crunchylists ΒΆ
type Crunchylists struct { Items []*CrunchylistPreview `json:"items"` TotalPublic int `json:"total_public"` TotalPrivate int `json:"total_private"` MaxPrivate int `json:"max_private"` // contains filtered or unexported fields }
Crunchylists contains all information about a crunchylists
func (*Crunchylists) Create ΒΆ
func (cl *Crunchylists) Create(name string) (*Crunchylist, error)
Create creates a new crunchylist with the given name. Duplicate names for lists are allowed.
type Crunchyroll ΒΆ
type Crunchyroll struct { // Client is the http.Client to perform all requests over. Client *http.Client // Context can be used to stop requests with Client and is context.Background by default. Context context.Context // Locale specifies in which language all results should be returned / requested. Locale LOCALE // RefreshToken is the crunchyroll beta equivalent to a session id (prior SessionID field in // this struct in v2 and below). RefreshToken string // Config stores parameters which are needed by some api calls. Config struct { TokenType string AccessToken string Bucket string CountryCode string Premium bool Channel string Policy string Signature string KeyPairID string AccountID string ExternalID string MaturityRating string } // contains filtered or unexported fields }
Crunchyroll is the base struct which is needed for every request and contains the most important information. Use LoginWithCredentials, LoginWithRefreshToken or LoginWithSessionID to create a new instance.
func LoginWithCredentials ΒΆ
func LoginWithCredentials(user string, password string, locale LOCALE, client *http.Client) (*Crunchyroll, error)
LoginWithCredentials logs in via crunchyroll username or email and password.
func LoginWithRefreshToken ΒΆ
func LoginWithRefreshToken(refreshToken string, locale LOCALE, client *http.Client) (*Crunchyroll, error)
LoginWithRefreshToken logs in via the crunchyroll refresh token. It can be obtained by copying the etp_rt cookie from beta.crunchyroll.com. The etp_rt cookie is automatically set when visiting https://beta-api.crunchyroll.com. Note that you need a crunchyroll account to access it.
func LoginWithSessionID
deprecated
LoginWithSessionID logs in via a crunchyroll session id. Session ids are automatically generated as a cookie when visiting https://beta-api.crunchyroll.com.
Deprecated: Login via session id caused some trouble in the past (e.g. #15 or #30) which resulted in login not working. Use LoginWithRefreshToken instead. The method will stay in the library until session id login is removed completely or login with it does not work for a longer period of time.
func (*Crunchyroll) Account ΒΆ
func (c *Crunchyroll) Account() (*Account, error)
Account returns information about the currently logged in crunchyroll account.
func (*Crunchyroll) Browse ΒΆ
func (c *Crunchyroll) Browse(options BrowseOptions, limit uint) (s []*Series, m []*Movie, err error)
Browse browses the crunchyroll catalog filtered by the specified options and returns all found series and movies within the given limit.
func (*Crunchyroll) Categories ΒΆ
func (c *Crunchyroll) Categories(includeSubcategories bool) (ca []*Category, err error)
Categories returns all available categories and possible subcategories.
func (*Crunchyroll) Crunchylists ΒΆ
func (c *Crunchyroll) Crunchylists() (*Crunchylists, error)
Crunchylists returns a struct to control crunchylists.
func (*Crunchyroll) ExtractEpisodesFromUrl ΒΆ
func (c *Crunchyroll) ExtractEpisodesFromUrl(url string, audio ...LOCALE) ([]*Episode, error)
ExtractEpisodesFromUrl extracts all episodes from an url. If audio is not empty, the episodes gets filtered after the given locale.
func (*Crunchyroll) FindEpisodeByName ΒΆ
func (c *Crunchyroll) FindEpisodeByName(seriesName, episodeTitle string) ([]*Episode, error)
FindEpisodeByName finds an episode by its crunchyroll series name and episode title. Use this in combination with ParseEpisodeURL and hand over the corresponding results to this function.
func (*Crunchyroll) FindVideoByName
deprecated
func (c *Crunchyroll) FindVideoByName(seriesName string) (Video, error)
FindVideoByName finds a Video (Season or Movie) by its name. Use this in combination with ParseVideoURL and hand over the corresponding results to this function.
Deprecated: Use Search instead. The first result sometimes isn't the correct one so this function is inaccurate in some cases. See https://github.com/ByteDream/crunchyroll-go/issues/22 for more information.
func (*Crunchyroll) InvalidateSession ΒΆ
func (c *Crunchyroll) InvalidateSession() error
InvalidateSession logs the user out which invalidates the current session. You have to call a login method again and create a new Crunchyroll instance if you want to perform any further actions since this instance is not usable anymore after calling this.
func (*Crunchyroll) IsCaching ΒΆ
func (c *Crunchyroll) IsCaching() bool
IsCaching returns if data gets cached or not. See SetCaching for more information.
func (*Crunchyroll) News ΒΆ
News returns the top and latest news from crunchyroll for the current locale within the given limits.
func (*Crunchyroll) ParseUrl ΒΆ
func (c *Crunchyroll) ParseUrl(url string) (*Series, []*Episode, error)
ParseUrl parses the given url into a series or episode. The returning episode is a slice because non-beta urls have the same episode with different languages.
func (*Crunchyroll) Recommendations ΒΆ
func (c *Crunchyroll) Recommendations(limit uint) (s []*Series, m []*Movie, err error)
Recommendations returns series and movie recommendations from crunchyroll based on the currently logged in account within the given limit.
func (*Crunchyroll) Search ΒΆ
Search searches a query and returns all found series and movies within the given limit.
func (*Crunchyroll) SetCaching ΒΆ
func (c *Crunchyroll) SetCaching(caching bool)
SetCaching enables or disables internal caching of requests made. Caching is enabled by default. If it is disabled the already cached data still gets called. The best way to prevent this is to create a complete new Crunchyroll struct.
func (*Crunchyroll) Simulcasts ΒΆ
func (c *Crunchyroll) Simulcasts() (s []*Simulcast, err error)
Simulcasts returns all available simulcast seasons for the current locale.
func (*Crunchyroll) UpNext ΒΆ
func (c *Crunchyroll) UpNext(limit uint) (e []*Episode, err error)
UpNext returns the episodes that are up next based on the currently logged in account within the given limit.
func (*Crunchyroll) WatchHistory ΒΆ
func (c *Crunchyroll) WatchHistory(page uint, size uint) (e []*HistoryEpisode, err error)
WatchHistory returns the history of watched episodes based on the currently logged in account from the given page with the given size.
func (*Crunchyroll) Watchlist ΒΆ
func (c *Crunchyroll) Watchlist(options WatchlistOptions, limit uint) ([]*WatchlistEntry, error)
Watchlist returns the watchlist entries for the currently logged in user.
type Downloader ΒΆ
type Downloader struct { // The output is all written to Writer. Writer io.Writer // TempDir is the directory where the temporary segment files should be stored. // The files will be placed directly into the root of the directory. // If empty a random temporary directory on the system's default tempdir // will be created. // If the directory does not exist, it will be created. TempDir string // If DeleteTempAfter is true, the temp directory gets deleted afterwards. // Note that in case of a hard signal exit (os.Interrupt, ...) the directory // will NOT be deleted. In such situations try to catch the signal and // cancel Context. DeleteTempAfter bool // Context to control the download process with. // There is a tiny delay when canceling the context and the actual stop of the // process. So it is not recommend stopping the program immediately after calling // the cancel function. It's better when canceling it and then exit the program // when Format.Download throws an error. See the signal handling section in // cmd/crunchyroll-go/cmd/download.go for an example. Context context.Context // Goroutines is the number of goroutines to download segments with. Goroutines int // A method to call when a segment was downloaded. // Note that the segments are downloaded asynchronously (depending on the count of // Goroutines) and the function gets called asynchronously too, so for example it is // first called on segment 1, then segment 254, then segment 3 and so on. OnSegmentDownload func(segment *m3u8.MediaSegment, current, total int, file *os.File) error // If LockOnSegmentDownload is true, only one OnSegmentDownload function can be called at // once. Normally (because of the use of goroutines while downloading) multiple could get // called simultaneously. LockOnSegmentDownload bool // If FFmpegOpts is not nil, ffmpeg will be used to merge and convert files. // The given opts will be used as ffmpeg parameters while merging. // // If Writer is *os.File and -f (which sets the output format) is not specified, the output // format will be retrieved by its file ending. If this is not the case and -f is not given, // the output format will be mpegts / mpeg transport stream. // Execute 'ffmpeg -muxers' to see all available output formats. FFmpegOpts []string }
Downloader is used to download Format's
func NewDownloader ΒΆ
func NewDownloader(context context.Context, writer io.Writer, goroutines int, onSegmentDownload func(segment *m3u8.MediaSegment, current, total int, file *os.File) error) Downloader
NewDownloader creates a downloader with default settings which should fit the most needs.
type Episode ΒΆ
type Episode struct { ID string `json:"id"` ChannelID string `json:"channel_id"` SeriesID string `json:"series_id"` SeriesTitle string `json:"series_title"` SeriesSlugTitle string `json:"series_slug_title"` SeasonID string `json:"season_id"` SeasonTitle string `json:"season_title"` SeasonSlugTitle string `json:"season_slug_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"` MaturityRatings []string `json:"maturity_ratings"` IsMature bool `json:"is_mature"` MatureBlocked bool `json:"mature_blocked"` EpisodeAirDate time.Time `json:"episode_air_date"` FreeAvailableDate time.Time `json:"free_available_date"` PremiumAvailableDate time.Time `json:"premium_available_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 MediaType `json:"media_type"` Slug string `json:"slug"` Images struct { Thumbnail [][]Image `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 }
Episode contains all information about an episode.
func EpisodeFromID ΒΆ
func EpisodeFromID(crunchy *Crunchyroll, id string) (*Episode, error)
EpisodeFromID returns an episode by its api id.
func (*Episode) AddToWatchlist ΒΆ
AddToWatchlist adds the current episode to the watchlist. Will return an RequestError with the response status code of 409 if the series was already on the watchlist before. There is currently a bug, or as I like to say in context of the crunchyroll api, feature, that only series and not individual episode can be added to the watchlist. Even though I somehow got an episode to my watchlist on the crunchyroll website, it never worked with the api here. So this function actually adds the whole series to the watchlist.
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. Will fail if no streams are available, thus use Episode.Available to prevent any misleading errors.
func (*Episode) Available ΒΆ
Available returns if downloadable streams for this episodes are available.
func (*Episode) GetFormat ΒΆ
GetFormat returns the format which matches the given resolution and subtitle locale.
func (*Episode) RemoveFromWatchlist ΒΆ
RemoveFromWatchlist removes the current episode from the watchlist. Will return an RequestError with the response status code of 404 if the series was not on the watchlist before.
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 }
Format contains detailed information about an episode video stream.
func (*Format) Download ΒΆ
func (f *Format) Download(downloader Downloader) error
Download downloads the Format with the via Downloader specified options.
func (*Format) InitVideo ΒΆ
InitVideo initializes the Format.Video completely. The Format.Video.Chunklist pointer is, by default, nil because an additional request must be made to receive its content. The request is not made when initializing a Format struct because it would probably cause an intense overhead since Format.Video.Chunklist is only used sometimes.
type FormatType ΒΆ
type FormatType string
FormatType represents if Format is an episode or a movie.
const ( EPISODE FormatType = "episodes" MOVIE = "movies" )
type HistoryEpisode ΒΆ
type HistoryEpisode struct { *Episode DatePlayed time.Time `json:"date_played"` ParentID string `json:"parent_id"` ParentType MediaType `json:"parent_type"` Playhead uint `json:"playhead"` FullyWatched bool `json:"fully_watched"` }
HistoryEpisode contains additional information about an episode if the account has watched or started to watch the episode.
type MediaType ΒΆ
type MediaType string
MediaType represents a media type.
const ( MediaTypeSeries MediaType = "series" MediaTypeMovie = "movie_listing" )
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 }
Movie contains information about a movie.
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.
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 [][]Image `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 }
MovieListing contains information about something which is called movie listing. I don't know what this means thb.
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 News ΒΆ
type News struct { Title string `json:"title"` Link string `json:"link"` Image string `json:"image"` Creator string `json:"creator"` PublishDate string `json:"publish_date"` Description string `json:"description"` }
News contains all information about news.
type OwnerReview ΒΆ
type OwnerReview struct { Review // contains filtered or unexported fields }
OwnerReview is a series review which has been written from the current logged-in user.
func (*OwnerReview) Delete ΒΆ
func (or *OwnerReview) Delete() error
Delete deletes the review from the logged in account.
type Panel ΒΆ
type Panel struct { Title string `json:"title"` PromoTitle string `json:"promo_title"` Slug string `json:"slug"` Playback string `json:"playback"` PromoDescription string `json:"promo_description"` Images struct { Thumbnail [][]Image `json:"thumbnail"` PosterTall [][]Image `json:"poster_tall"` PosterWide [][]Image `json:"poster_wide"` } `json:"images"` ID string `json:"id"` Description string `json:"description"` ChannelID string `json:"channel_id"` Type WatchlistEntryType `json:"type"` ExternalID string `json:"external_id"` SlugTitle string `json:"slug_title"` // not null if Type is WATCHLISTENTRYEPISODE EpisodeMetadata *Episode `json:"episode_metadata"` // not null if Type is WATCHLISTENTRYSERIES SeriesMetadata *Series `json:"series_metadata"` }
type Rating ΒΆ
type Rating struct { OneStar ratingStar `json:"1s"` TwoStars ratingStar `json:"2s"` ThreeStars ratingStar `json:"3s"` FourStars ratingStar `json:"4s"` FiveStars ratingStar `json:"5s"` Average string `json:"average"` Total int `json:"total"` Rating string `json:"rating"` }
Rating represents the overall rating of a series.
type RequestError ΒΆ
type RequestError struct { Response *http.Response Message string // contains filtered or unexported fields }
RequestError is an error interface which gets used whenever a crunchyroll delivers an error response.
func (*RequestError) Error ΒΆ
func (re *RequestError) Error() string
type Review ΒΆ
type Review interface{}
Review is the interface which gets implemented by OwnerReview and UserReview.
type ReviewOptions ΒΆ
type ReviewOptions struct { // Sort specifies how the items should be sorted. Sort ReviewSortType `json:"sort"` // Filter specified after which the returning items should be filtered. Filter ReviewRating `json:"filter"` }
ReviewOptions represents options for fetching series reviews.
type ReviewRating ΒΆ
type ReviewRating string
ReviewRating represents stars for a series rating from one to five.
type ReviewSortType ΒΆ
type ReviewSortType string
ReviewSortType represents a sort type to sort Series.Reviews items after.
type Season ΒΆ
type Season struct { ID string `json:"id"` ChannelID string `json:"channel_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"` AvailabilityNotes string `json:"availability_notes"` // the locales are always empty, idk why, this may change in the future AudioLocales []LOCALE SubtitleLocales []LOCALE // contains filtered or unexported fields }
Season contains information about an anime season.
func SeasonFromID ΒΆ
func SeasonFromID(crunchy *Crunchyroll, id string) (*Season, error)
SeasonFromID returns a season by its api id.
func (*Season) AudioLocale ΒΆ
AudioLocale returns the audio locale of the season. Will fail if no streams are available, thus use Season.Available to prevent any misleading errors.
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 }
Series contains information about an anime series.
func SeriesFromID ΒΆ
func SeriesFromID(crunchy *Crunchyroll, id string) (*Series, error)
SeriesFromID returns a series by its api id.
func (*Series) AddToWatchlist ΒΆ
AddToWatchlist adds the current episode to the watchlist. Will return an RequestError with the response status code of 409 if the series was already on the watchlist before.
func (*Series) CreateReview ΒΆ
func (s *Series) CreateReview(title, content string, spoiler bool) (*OwnerReview, error)
CreateReview creates a review for the current series with the logged-in account. Will fail if a review is already present. Check Series.HasOwnerReview if the account has already written a review. If this is the case, use Series.GetOwnerReview and user OwnerReview.Edit to edit the review.
func (*Series) GetOwnerReview ΒΆ
func (s *Series) GetOwnerReview() (*OwnerReview, error)
GetOwnerReview returns the series review, written by the current logged-in account. Returns an error if no review was written yet.
func (*Series) HasOwnerReview ΒΆ
HasOwnerReview returns if the logged-in account has written a review for the series.
func (*Series) Rate ΒΆ
func (s *Series) Rate(rating ReviewRating) error
Rate rates the current series.
func (*Series) RemoveFromWatchlist ΒΆ
RemoveFromWatchlist removes the current episode from the watchlist. Will return an RequestError with the response status code of 404 if the series was not on the watchlist before.
func (*Series) Reviews ΒΆ
func (s *Series) Reviews(options ReviewOptions, page uint, size uint) (BulkResult[*UserReview], error)
Reviews returns user reviews for the series.
type Simulcast ΒΆ
type Simulcast struct { ID string `json:"id"` Localization struct { Title string `json:"title"` // appears to be always an empty string. Description string `json:"description"` } `json:"localization"` }
Simulcast contains all information about a simulcast season.
type Stream ΒΆ
type Stream struct { HardsubLocale LOCALE AudioLocale LOCALE Subtitles []*Subtitle // contains filtered or unexported fields }
Stream contains information about all available video stream of an episode.
func StreamsFromID ΒΆ
func StreamsFromID(crunchy *Crunchyroll, id string) ([]*Stream, error)
StreamsFromID returns a stream by its api id.
type Subtitle ΒΆ
type Subtitle struct { Locale LOCALE `json:"locale"` URL string `json:"url"` Format string `json:"format"` // contains filtered or unexported fields }
Subtitle contains the information about a video subtitle.
type UserReview ΒΆ
type UserReview struct { Review // contains filtered or unexported fields }
UserReview is a series review written from other crunchyroll users.
func (*UserReview) RateHelpful ΒΆ
func (ur *UserReview) RateHelpful() error
RateHelpful rates the review as helpful. A review can only be rated once as helpful (or not helpful) and this cannot be undone, so be careful. Use Rated to see if the review was already rated.
func (*UserReview) RateNotHelpful ΒΆ
func (ur *UserReview) RateNotHelpful() error
RateNotHelpful rates the review as not helpful. A review can only be rated once as helpful (or not helpful) and this cannot be undone, so be careful. Use Rated to see if the review was already rated.
func (*UserReview) Rated ΒΆ
func (ur *UserReview) Rated() bool
Rated returns if the user already rated the review (with RateHelpful or RateNotHelpful).
func (*UserReview) RemoveReport ΒΆ
func (ur *UserReview) RemoveReport() error
RemoveReport removes the report request from the review. Only works if the user has reported the review. See UserReview.Ratings.Reported if it is already reported.
func (*UserReview) Report ΒΆ
func (ur *UserReview) Report() error
Report reports the review. Only works if the review hasn't been reported yet. See UserReview.Ratings.Reported if it is already reported.
type Wallpaper ΒΆ
type Wallpaper string
Wallpaper contains a wallpaper name which can be set via Account.ChangeWallpaper.
type WatchlistEntry ΒΆ
type WatchlistEntry struct { Panel Panel `json:"panel"` New bool `json:"new"` NewContent bool `json:"new_content"` IsFavorite bool `json:"is_favorite"` NeverWatched bool `json:"never_watched"` CompleteStatus bool `json:"complete_status"` Playahead uint `json:"playahead"` }
WatchlistEntry contains information about an entry on the watchlist.
type WatchlistEntryType ΒΆ
type WatchlistEntryType string
WatchlistEntryType specifies which type a watchlist entry has.
type WatchlistLanguageType ΒΆ
type WatchlistLanguageType int
WatchlistLanguageType represents a filter type to filter Crunchyroll.Watchlist entries after sub or dub.
const ( WatchlistLanguageSubbed WatchlistLanguageType = iota + 1 WatchlistLanguageDubbed )
type WatchlistOptions ΒΆ
type WatchlistOptions struct { // Order specified whether the results should be order ascending or descending. Order WatchlistOrderType // OnlyFavorites specifies whether only episodes which are marked as favorite should be returned. OnlyFavorites bool // LanguageType specifies whether returning episodes should be only subbed or dubbed. LanguageType WatchlistLanguageType // ContentType specified whether returning videos should only be series episodes or movies. // But tbh all movies I've searched on crunchy were flagged as series too, so this // parameter is kinda useless. ContentType MediaType }
WatchlistOptions represents options for receiving the user watchlist.
type WatchlistOrderType ΒΆ
type WatchlistOrderType string
WatchlistOrderType represents how Crunchyroll.Watchlist entries should be ordered.
Source Files ΒΆ
- account.go
- category.go
- comment.go
- common.go
- crunchylists.go
- crunchyroll.go
- downloader.go
- episode.go
- error.go
- format.go
- movie_listing.go
- news.go
- parse.go
- review.go
- search.go
- season.go
- simulcast.go
- stream.go
- subtitle.go
- suggestions.go
- url.go
- utils.go
- video.go
- wallpaper.go
- watch_history.go
- watchlist.go