Skip to contents

Get details for a show's seasons, e.g. how many seasons there are and how many epsiodes each season has. With episodes == TRUE and extended == "full", this function is also suitable to retrieve all episode data for all seasons of a show with just a single API call.

Usage

seasons_summary(
  id,
  episodes = FALSE,
  drop_specials = TRUE,
  drop_unaired = TRUE,
  extended = c("min", "full")
)

Source

seasons_summary() wraps endpoint shows/:id/seasons.

Arguments

id

character(1): The ID of the item requested. Preferably the trakt ID (e.g. 1429). Other options are the trakt.tv slug (e.g. "the-wire") or imdb ID (e.g. "tt0306414"). Can also be of length greater than 1, in which case the function is called on all id values separately and the result is combined. See vignette("finding-things") for more details.

episodes

logical(1) [FALSE]: If TRUE, all episodes for each season are appended as a list-column, with the amount of variables depending on extended.

drop_specials

logical(1) [TRUE]: Special episodes (season 0) are dropped

drop_unaired

logical(1) [TRUE]: Seasons without aired episodes are dropped. Only works if extended is "full".

extended

character(1): Either "min" (API default) or "full". The latter returns more variables and should generally only be used if required. See vignette("finding-things") for more details.

Value

A tibble(). If the function has a limit parameter (defaulting to 10), this will be the (maximum) number of rows of the tibble. If there are no results (or the API is unreachable), an empty tibble() is returned.

Examples

# Get just the season numbers and their IDs
seasons_summary("breaking-bad", extended = "min")
#> # A tibble: 5 × 4
#>   season trakt tvdb   tmdb 
#>    <int> <chr> <chr>  <chr>
#> 1      1 3950  30272  3572 
#> 2      2 3951  40719  3573 
#> 3      3 3952  171641 3575 
#> 4      4 3953  297361 3576 
#> 5      5 3954  490110 3578 
if (FALSE) {
# Get season numbers, ratings, votes, titles and other metadata as well as
# a list-column containing all episode data
seasons_summary("utopia", extended = "full", episodes = TRUE)
}