Add watch history

This commit is contained in:
IchBinLeoon 2022-05-28 19:55:56 +02:00
parent 08c46e50bb
commit cf35596985
3 changed files with 55 additions and 13 deletions

View file

@ -75,6 +75,18 @@ type Episode struct {
StreamID string
}
// HistoryEpisode contains additional information about an episode if the account has watched or started to watch the episode.
type HistoryEpisode struct {
*Episode
ID string `json:"id"`
DatePlayed string `json:"date_played"`
ParentID string `json:"parent_id"`
ParentType MediaType `json:"parent_type"`
Playhead uint `json:"playhead"`
FullyWatched bool `json:"fully_watched"`
}
// EpisodeFromID returns an episode by its api id.
func EpisodeFromID(crunchy *Crunchyroll, id string) (*Episode, error) {
resp, err := crunchy.request(fmt.Sprintf("https://beta-api.crunchyroll.com/cms/v2/%s/%s/%s/episodes/%s?locale=%s&Signature=%s&Policy=%s&Key-Pair-Id=%s",