diff --git a/common.go b/common.go index 91e1312..b76a8fe 100644 --- a/common.go +++ b/common.go @@ -1,5 +1,12 @@ package crunchyroll +type Image struct { + Height int `json:"height"` + Source string `json:"source"` + Type string `json:"type"` + Width int `json:"width"` +} + type Panel struct { Title string `json:"title"` PromoTitle string `json:"promo_title"` @@ -7,24 +14,9 @@ type Panel struct { Playback string `json:"playback"` PromoDescription string `json:"promo_description"` Images struct { - Thumbnail [][]struct { - Height int `json:"height"` - Source string `json:"source"` - Type string `json:"type"` - Width int `json:"width"` - } `json:"thumbnail"` - PosterTall [][]struct { - Width int `json:"width"` - Height int `json:"height"` - Type string `json:"type"` - Source string `json:"source"` - } `json:"poster_tall"` - PosterWide [][]struct { - Width int `json:"width"` - Height int `json:"height"` - Type string `json:"type"` - Source string `json:"source"` - } `json:"poster_wide"` + Thumbnail [][]Image `json:"thumbnail"` + PosterTall [][]Image `json:"poster_tall"` + PosterWide [][]Image `json:"poster_wide"` } `json:"images"` ID string `json:"id"` Description string `json:"description"` diff --git a/episode.go b/episode.go index 7f48e93..7d9caac 100644 --- a/episode.go +++ b/episode.go @@ -61,12 +61,7 @@ type Episode struct { 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"` + Thumbnail [][]Image `json:"thumbnail"` } `json:"images"` DurationMS int `json:"duration_ms"` diff --git a/movie_listing.go b/movie_listing.go index 110f67a..81cb48d 100644 --- a/movie_listing.go +++ b/movie_listing.go @@ -19,12 +19,7 @@ type MovieListing struct { 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"` + Thumbnail [][]Image `json:"thumbnail"` } `json:"images"` DurationMS int `json:"duration_ms"` diff --git a/video.go b/video.go index 3e7d7cf..3a67f5c 100644 --- a/video.go +++ b/video.go @@ -17,18 +17,8 @@ type video struct { SlugTitle string `json:"slug_title"` Images struct { - PosterTall [][]struct { - Height int `json:"height"` - Source string `json:"source"` - Type string `json:"type"` - Width int `json:"width"` - } `json:"poster_tall"` - PosterWide [][]struct { - Height int `json:"height"` - Source string `json:"source"` - Type string `json:"type"` - Width int `json:"width"` - } `json:"poster_wide"` + PosterTall [][]Image `json:"poster_tall"` + PosterWide [][]Image `json:"poster_wide"` } `json:"images"` }