mirror of
https://github.com/crunchy-labs/crunchy-cli.git
synced 2026-01-21 20:22:01 -06:00
Merge branch 'next/v3' into v3/feature/non-premium-support
This commit is contained in:
commit
ae075ed4c9
27 changed files with 1173 additions and 205 deletions
14
episode.go
14
episode.go
|
|
@ -3,6 +3,7 @@ package crunchyroll
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
|
@ -75,6 +76,17 @@ 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
|
||||
|
||||
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"`
|
||||
}
|
||||
|
||||
// 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/episodes/%s?locale=%s&Signature=%s&Policy=%s&Key-Pair-Id=%s",
|
||||
|
|
@ -83,7 +95,7 @@ func EpisodeFromID(crunchy *Crunchyroll, id string) (*Episode, error) {
|
|||
crunchy.Locale,
|
||||
crunchy.Config.Signature,
|
||||
crunchy.Config.Policy,
|
||||
crunchy.Config.KeyPairID))
|
||||
crunchy.Config.KeyPairID), http.MethodGet)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue