Package 'tRakt'

Title: Get Data from 'trakt.tv'
Description: A wrapper for the <https://trakt.tv> API to retrieve data about shows and movies, including user ratings, credits and related metadata. Additional functions retrieve user-specific information including collections and history of watched items. A full API reference is available at <https://trakt.docs.apiary.io>.
Authors: Lukas Burk [aut, cre]
Maintainer: Lukas Burk <[email protected]>
License: MIT + file LICENSE
Version: 0.16.9000
Built: 2024-10-31 05:36:30 UTC
Source: https://github.com/jemus42/tRakt

Help Index


Anticipated media

Description

These functions return the most anticipated movies/shows on trakt.tv.

Usage

movies_anticipated(
  limit = 10,
  extended = c("min", "full"),
  query = NULL,
  years = NULL,
  genres = NULL,
  languages = NULL,
  countries = NULL,
  runtimes = NULL,
  ratings = NULL,
  certifications = NULL
)

shows_anticipated(
  limit = 10,
  extended = c("min", "full"),
  query = NULL,
  years = NULL,
  genres = NULL,
  languages = NULL,
  countries = NULL,
  runtimes = NULL,
  ratings = NULL,
  certifications = NULL,
  networks = NULL,
  status = NULL
)

Arguments

limit

integer(1) [10L]: Number of items to return. Must be greater than 0 and will be coerced via as.integer().

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.

query

character(1): Search string for titles and descriptions. For search_query() other fields are searched depending on the type of media. See the API docs for a full reference.

years

character | integer: 4-digit year (2010) or range, e.g. "2010-2020". Can also be an integer vector of length two which will be coerced appropriately, e.g. c(2010, 2020).

genres

character(n): Genre slug(s). See trakt_genres for a table of genres. Multiple values are allowed and will be concatenated.

languages

character(n): Two-letter language code(s). Also see trakt_languages for available languages (code and name).

countries

character(n): Two-letter country code(s). See trakt_countries.

runtimes

character | integer: Integer range in minutes, e.g. 30-90. Can also be an integer vector of length two which will be coerced appropriately.

ratings

character | integer: Integer range between 0 and 100. Can also be an integer vector of length two which will be coerced appropriately. Note that user-supplied ratings are in the range of 1 to 10, yet the ratings on the site itself are scaled to the range of 1 to 100.

certifications

character(n): Certification(s) like pg-13. Multiple values are allowed. Use trakt_certifications for reference. Note that there are different certifications for shows and movies.

networks

character(n): (Shows only) Network name like HBO. See trakt_networks for a list of known networks.

status

character(n): (Shows only) The status of the shows. One of "returning series", "in production", "planned", "canceled", or "ended".

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.

The Dynamic Lists on trakt.tv

These functions access the automatically updated lists provided by trakt.tv. Each function comes in two flavors: Shows or movies. The following descriptions are adapted directly from the API reference.

  • Popular: Popularity is calculated using the rating percentage and the number of ratings.

  • Trending: Returns all movies/shows being watched right now. Movies/shows with the most users are returned first.

  • Played: Returns the most played (a single user can watch multiple times) movies/shows in the specified time period.

  • Watched: Returns the most watched (unique users) movies/shows in the specified time period.

  • Collected: Returns the most collected (unique users) movies/shows in the specified time period.

  • Anticipated: Returns the most anticipated movies/shows based on the number of lists a movie/show appears on. The functions for Played, Watched, Collected and Played each return the same additional variables besides the media information: watcher_count, play_count, collected_count, collector_count.

Source

movies_anticipated() wraps endpoint movies/anticipated.

shows_anticipated() wraps endpoint shows/anticipated.

See Also

Other movie data: collected_media, media_aliases, media_comments, media_lists, media_people, media_ratings(), media_stats(), media_translations, media_watching, movies_boxoffice(), movies_related(), movies_releases(), movies_summary(), people_media(), played_media, popular_media, trending_media, watched_media

Other dynamic lists: collected_media, lists_popular(), played_media, popular_media, trending_media, watched_media

Other shows data: popular_media, trending_media, watched_media

Other dynamic lists: collected_media, lists_popular(), played_media, popular_media, trending_media, watched_media

Examples

## Not run: 
# Get 15 the most anticipated upcoming shows on Netflix that air this year
current_year <- format(Sys.Date(), "%Y")
shows_anticipated(limit = 15, networks = "Netflix", years = current_year)

## End(Not run)

Assemble a trakt.tv API URL

Description

build_trakt_url assembles a trakt.tv API URL from different arguments. The result should be fine for use with trakt_get, since that's what this function was created for.

Usage

build_trakt_url(..., validate = FALSE)

Arguments

...

Unnamed arguments will be concatenated with / as separators to form the path of the API URL, e.g. the arguments movies, tron-legacy-2012 and releases will be concatenated to movies/tron-legacy-2012/releases. Additional named arguments will be used as query parameters, usually extended = "full" or others.

validate

logical(1) [TRUE]: Whether to check the URL via httr::HEAD request.

Value

A URL: character of length 1. If validate = TRUE, also a message including the HTTP status code return by a HEAD request.

Note

Please be aware that the result of this function is not verified to be a working trakt.tv API URL unless validate = TRUE, in which case a HEAD request is performed that does not actually receive any data, but from its returned status code the validity of the URL can be inferred.

See Also

Other utility functions: pad_episode()

Examples

build_trakt_url("shows", "breaking-bad", extended = "full")
build_trakt_url("shows", "popular", page = 3, limit = 5)

# Path can also be partially assembled already
build_trakt_url("users/jemus42", "ratings")

# Validate a URL works
build_trakt_url("shows", "popular", page = 1, limit = 5, validate = TRUE)

Most collected media

Description

These functions return the most collected movies/shows on trakt.tv.

Usage

movies_collected(
  limit = 10,
  extended = c("min", "full"),
  period = c("weekly", "monthly", "yearly", "all"),
  query = NULL,
  years = NULL,
  genres = NULL,
  languages = NULL,
  countries = NULL,
  runtimes = NULL,
  ratings = NULL,
  certifications = NULL
)

shows_collected(
  limit = 10,
  extended = c("min", "full"),
  period = c("weekly", "monthly", "yearly", "all"),
  query = NULL,
  years = NULL,
  genres = NULL,
  languages = NULL,
  countries = NULL,
  runtimes = NULL,
  ratings = NULL,
  certifications = NULL,
  networks = NULL,
  status = NULL
)

Arguments

limit

integer(1) [10L]: Number of items to return. Must be greater than 0 and will be coerced via as.integer().

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.

period

character(1) ["weekly"]: Which period to filter by. Possible values are "weekly", "monthly", "yearly", "all".

query

character(1): Search string for titles and descriptions. For search_query() other fields are searched depending on the type of media. See the API docs for a full reference.

years

character | integer: 4-digit year (2010) or range, e.g. "2010-2020". Can also be an integer vector of length two which will be coerced appropriately, e.g. c(2010, 2020).

genres

character(n): Genre slug(s). See trakt_genres for a table of genres. Multiple values are allowed and will be concatenated.

languages

character(n): Two-letter language code(s). Also see trakt_languages for available languages (code and name).

countries

character(n): Two-letter country code(s). See trakt_countries.

runtimes

character | integer: Integer range in minutes, e.g. 30-90. Can also be an integer vector of length two which will be coerced appropriately.

ratings

character | integer: Integer range between 0 and 100. Can also be an integer vector of length two which will be coerced appropriately. Note that user-supplied ratings are in the range of 1 to 10, yet the ratings on the site itself are scaled to the range of 1 to 100.

certifications

character(n): Certification(s) like pg-13. Multiple values are allowed. Use trakt_certifications for reference. Note that there are different certifications for shows and movies.

networks

character(n): (Shows only) Network name like HBO. See trakt_networks for a list of known networks.

status

character(n): (Shows only) The status of the shows. One of "returning series", "in production", "planned", "canceled", or "ended".

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.

The Dynamic Lists on trakt.tv

These functions access the automatically updated lists provided by trakt.tv. Each function comes in two flavors: Shows or movies. The following descriptions are adapted directly from the API reference.

  • Popular: Popularity is calculated using the rating percentage and the number of ratings.

  • Trending: Returns all movies/shows being watched right now. Movies/shows with the most users are returned first.

  • Played: Returns the most played (a single user can watch multiple times) movies/shows in the specified time period.

  • Watched: Returns the most watched (unique users) movies/shows in the specified time period.

  • Collected: Returns the most collected (unique users) movies/shows in the specified time period.

  • Anticipated: Returns the most anticipated movies/shows based on the number of lists a movie/show appears on. The functions for Played, Watched, Collected and Played each return the same additional variables besides the media information: watcher_count, play_count, collected_count, collector_count.

Source

movies_collected() wraps endpoint movies/collected/:period.

shows_collected() wraps endpoint shows/collected/:period.

See Also

Other movie data: anticipated_media, media_aliases, media_comments, media_lists, media_people, media_ratings(), media_stats(), media_translations, media_watching, movies_boxoffice(), movies_related(), movies_releases(), movies_summary(), people_media(), played_media, popular_media, trending_media, watched_media

Other dynamic lists: anticipated_media, lists_popular(), played_media, popular_media, trending_media, watched_media

Other show data: media_aliases, media_comments, media_lists, media_people, media_ratings(), media_stats(), media_translations, media_watching, people_media(), played_media, shows_next_episode(), shows_related(), shows_summary()

Other dynamic lists: anticipated_media, lists_popular(), played_media, popular_media, trending_media, watched_media


Get a single comment

Description

Get a single comment

Usage

comments_comment(id, extended = c("min", "full"))

comments_replies(id, extended = c("min", "full"))

comments_likes(id, extended = c("min", "full"))

comments_item(id, extended = c("min", "full"))

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.

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.

Functions

  • comments_replies(): Get a comment's replies

  • comments_likes(): Get users who liked a comment.

  • comments_item(): Get the media item attached to the comment.

Source

comments_comment() wraps endpoint comments/:id.

comments_replies() wraps endpoint comments/:id/replies.

comments_likes() wraps endpoint comments/:id/likes.

comments_item() wraps endpoint comments/:id/item.

See Also

Other comment methods: comments_trending(), comments_updates(), media_comments, user_comments(), user_list_comments()

Other summary methods: episodes_summary(), movies_summary(), people_summary(), seasons_summary(), shows_summary(), user_profile()

Other comment methods: comments_trending(), comments_updates(), media_comments, user_comments(), user_list_comments()

Other comment methods: comments_trending(), comments_updates(), media_comments, user_comments(), user_list_comments()

Other comment methods: comments_trending(), comments_updates(), media_comments, user_comments(), user_list_comments()

Examples

# A single comment
comments_comment("236397")

# Multiple comments
comments_comment(c("236397", "112561"))
## Not run: 
comments_replies("236397")

## End(Not run)
## Not run: 
comments_likes("236397")

## End(Not run)
## Not run: 
# A movie
comments_item("236397")
comments_item("236397", extended = "full")

# A show
comments_item("120768")
comments_item("120768", extended = "full")

# A season
comments_item("140265")
comments_item("140265", extended = "full")

# An episode
comments_item("136632")
comments_item("136632", extended = "full")

## End(Not run)

Get recently updated/edited comments

Description

Get recently updated/edited comments

Usage

comments_updates(
  comment_type = c("all", "reviews", "shouts"),
  type = c("all", "movies", "shows", "seasons", "episodes", "lists"),
  include_replies = FALSE,
  limit = 10L
)

Arguments

comment_type

character(1) ["all"]: The type of comment, one of "all", "reviews" or "shouts".

type

character(1) ["all"]: The type of media to filter by, one of "all", "movies", "shows", "seasons", "episodes" or "lists".

include_replies

logical(1) [FALSE]: Whether to include replies.

limit

integer(1) [10L]: Number of items to return. Must be greater than 0 and will be coerced via as.integer().

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.

Source

comments_updates() wraps endpoint comments/updates/:comment_type/:type?include_replies=.

See Also

Other comment methods: comments_comment(), comments_trending(), media_comments, user_comments(), user_list_comments()

Examples

# Recently updated comments
comments_updates()

Get a single episode's details

Description

This retrieves a single episode. See seasons_season for a whole season, and seasons_summary for (potentially) all episodes of a show.

Usage

episodes_summary(id, season = 1L, episode = 1L, extended = c("min", "full"))

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.

season, episode

integer(1) [1L]: The season and eisode number. If longer, e.g. 1:5, the function is vectorized and the output will be combined. This may result in a lot of API calls. Use wisely.

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.

Source

episodes_summary() wraps endpoint shows/:id/seasons/:season/episodes/:episode.

See Also

Other episode data: media_comments, media_lists, media_people, media_ratings(), media_stats(), media_translations, media_watching, seasons_season(), seasons_summary(), shows_next_episode()

Other summary methods: comments_comment(), movies_summary(), people_summary(), seasons_summary(), shows_summary(), user_profile()

Examples

# Get just this one episode with its ratings, votes, etc.
episodes_summary("breaking-bad", season = 1, episode = 1, extended = "full")

Futurama episodes

Description

This data comes from https://trakt.tv and serves as an example of episode data output.

Usage

futurama

Format

A tibble() with 124 rows and 18 variables:

episode, season

Episode within each season and season number

title

Episode title

episode_abs

Overall episode number

overview

Episode summary

rating

Rating (1-10) on trakt.tv

votes

Number of votes ontrakt.tv

comment_count

Number of comments on episode page

first_aired, updated_at

Original air date and last update in UTC as POSIXct

runtime

Runtime in minutes

trakt, tvdb, tmdb

Episode IDs for trakt.tv, TVDb, and TMDb

available_translations

List-column of available translation on trakt.tv

See Also

Other Episode datasets: gameofthrones

Examples

futurama

Game of Thrones episodes

Description

This data comes from https://trakt.tv and https://en.wikipedia.org/wiki/List_of_Game_of_Thrones_episodes.

Usage

gameofthrones

Format

A tibble() with 67 rows and 17 variables:

episode_abs

Overall episode number

episode, season

Episode within each season and season number

title

Episode title

overview

Episode summary

rating

Rating (1-10) on trakt.tv

votes

Number of votes ontrakt.tv

viewers

Viewers according to Wikipedia

director, writer

Directing and writing credits

comment_count

Number of comments on episode page

first_aired, updated_at

Original air date and last update in UTC as POSIXct

runtime

Runtime in minutes

trakt, tvdb, tmdb

Episode IDs for trakt.tv, TVDb, and TMDb

year

Year of first airing

epid

Episode ID in s00e00 format

See Also

Other Episode datasets: futurama

Examples

gameofthrones

Get all movie / show aliases

Description

Get all movie / show aliases

Usage

movies_aliases(id)

shows_aliases(id)

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.

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.

Source

movies_aliases() wraps endpoint movies/:id/aliases.

shows_aliases() wraps endpoint shows/:id/aliases.

See Also

Other movie data: anticipated_media, collected_media, media_comments, media_lists, media_people, media_ratings(), media_stats(), media_translations, media_watching, movies_boxoffice(), movies_related(), movies_releases(), movies_summary(), people_media(), played_media, popular_media, trending_media, watched_media

Other show data: collected_media, media_comments, media_lists, media_people, media_ratings(), media_stats(), media_translations, media_watching, people_media(), played_media, shows_next_episode(), shows_related(), shows_summary()

Examples

movies_aliases(190430)
shows_aliases(104439)

Get all comments of a thing

Description

Get all comments of a thing

Usage

movies_comments(
  id,
  sort = c("newest", "oldest", "likes", "replies"),
  extended = c("min", "full"),
  limit = 10L
)

shows_comments(
  id,
  sort = c("newest", "oldest", "likes", "replies"),
  extended = c("min", "full"),
  limit = 10L
)

seasons_comments(
  id,
  season = 1L,
  sort = c("newest", "oldest", "likes", "replies"),
  extended = c("min", "full"),
  limit = 10L
)

episodes_comments(
  id,
  season = 1L,
  episode = 1L,
  sort = c("newest", "oldest", "likes", "replies"),
  extended = c("min", "full"),
  limit = 10L
)

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.

sort

character(1) ["newest"]: Comment sort order, one of "newest", "oldest", "likes" or "replies".

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.

limit

integer(1) [10L]: Number of items to return. Must be greater than 0 and will be coerced via as.integer().

season, episode

integer(1) [1L]: The season and eisode number. If longer, e.g. 1:5, the function is vectorized and the output will be combined. This may result in a lot of API calls. Use wisely.

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.

Functions

  • movies_comments(): Get comments for a movie

  • shows_comments(): Get comments for a movie

  • seasons_comments(): Get comments for a season

  • episodes_comments(): Get comments for an episode

Source

movies_comments() wraps endpoint movies/:id/comments/:sort.

shows_comments() wraps endpoint shows/:id/comments/:sort.

seasons_comments() wraps endpoint shows/:id/seasons/:season/comments/:sort.

episodes_comments() wraps endpoint shows/:id/seasons/:season/episodes/:episode/comments/:sort.

See Also

Other comment methods: comments_comment(), comments_trending(), comments_updates(), user_comments(), user_list_comments()

Other movie data: anticipated_media, collected_media, media_aliases, media_lists, media_people, media_ratings(), media_stats(), media_translations, media_watching, movies_boxoffice(), movies_related(), movies_releases(), movies_summary(), people_media(), played_media, popular_media, trending_media, watched_media

Other show data: collected_media, media_aliases, media_lists, media_people, media_ratings(), media_stats(), media_translations, media_watching, people_media(), played_media, shows_next_episode(), shows_related(), shows_summary()

Other season data: media_lists, media_people, media_ratings(), media_stats(), seasons_season(), seasons_summary()

Other episode data: episodes_summary(), media_lists, media_people, media_ratings(), media_stats(), media_translations, media_watching, seasons_season(), seasons_summary(), shows_next_episode()

Examples

## Not run: 
movies_comments(193972)
shows_comments(46241, sort = "likes")
seasons_comments(46241, season = 1, sort = "likes")
episodes_comments(46241, season = 1, episode = 2, sort = "likes")

## End(Not run)

Get lists containing a movie, show, season, episode or person

Description

Get lists containing a movie, show, season, episode or person

Usage

movies_lists(
  id,
  type = c("all", "personal", "official", "watchlists"),
  sort = c("popular", "likes", "comments", "items", "added", "updated"),
  limit = 10L,
  extended = c("min", "full")
)

shows_lists(
  id,
  type = c("all", "personal", "official", "watchlists"),
  sort = c("popular", "likes", "comments", "items", "added", "updated"),
  limit = 10L,
  extended = c("min", "full")
)

seasons_lists(
  id,
  season,
  type = c("all", "personal", "official", "watchlists"),
  sort = c("popular", "likes", "comments", "items", "added", "updated"),
  limit = 10L,
  extended = c("min", "full")
)

episodes_lists(
  id,
  season,
  episode,
  type = c("all", "personal", "official", "watchlists"),
  sort = c("popular", "likes", "comments", "items", "added", "updated"),
  limit = 10L,
  extended = c("min", "full")
)

people_lists(
  id,
  type = c("all", "personal", "official", "watchlists"),
  sort = c("popular", "likes", "comments", "items", "added", "updated"),
  limit = 10L,
  extended = c("min", "full")
)

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.

type

character(1) ["all"]: The type of list, one of "all", "personal", "official" or "watchlists".

sort

character(1) ["popular"]: Sort lists by one of "popular", "likes", "comments", "items", "added" or "updated".

limit

integer(1) [10L]: Number of items to return. Must be greater than 0 and will be coerced via as.integer().

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.

season, episode

integer(1) [1L]: The season and eisode number. If longer, e.g. 1:5, the function is vectorized and the output will be combined. This may result in a lot of API calls. Use wisely.

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.

Functions

  • movies_lists(): Lists containing a movie.

  • shows_lists(): Lists containing a show.

  • seasons_lists(): Lists containing a season.

  • episodes_lists(): Lists containing an episode.

  • people_lists(): Lists containing a person.

Source

movies_lists() wraps endpoint movies/:id/lists/:type/:sort.

shows_lists() wraps endpoint shows/:id/lists/:type/:sort.

seasons_lists() wraps endpoint shows/:id/seasons/:season/lists/:type/:sort.

episodes_lists() wraps endpoint shows/:id/seasons/:season/episodes/:episode/lists/:type/:sort.

See Also

Other list methods: lists_popular(), user_list(), user_list_comments(), user_list_items(), user_lists()

Other movie data: anticipated_media, collected_media, media_aliases, media_comments, media_people, media_ratings(), media_stats(), media_translations, media_watching, movies_boxoffice(), movies_related(), movies_releases(), movies_summary(), people_media(), played_media, popular_media, trending_media, watched_media

Other list methods: lists_popular(), user_list(), user_list_comments(), user_list_items(), user_lists()

Other show data: collected_media, media_aliases, media_comments, media_people, media_ratings(), media_stats(), media_translations, media_watching, people_media(), played_media, shows_next_episode(), shows_related(), shows_summary()

Other list methods: lists_popular(), user_list(), user_list_comments(), user_list_items(), user_lists()

Other season data: media_comments, media_people, media_ratings(), media_stats(), seasons_season(), seasons_summary()

Other list methods: lists_popular(), user_list(), user_list_comments(), user_list_items(), user_lists()

Other episode data: episodes_summary(), media_comments, media_people, media_ratings(), media_stats(), media_translations, media_watching, seasons_season(), seasons_summary(), shows_next_episode()

Other list methods: lists_popular(), user_list(), user_list_comments(), user_list_items(), user_lists()

Other people data: media_people, people_media(), people_summary()

Examples

## Not run: 
movies_lists("190430", type = "personal", limit = 5)

## End(Not run)
## Not run: 
shows_lists("46241")

## End(Not run)
## Not run: 
seasons_lists("46241", season = 1)

## End(Not run)
## Not run: 
episodes_lists("46241", season = 1, episode = 1)

## End(Not run)
## Not run: 
people_lists("david-tennant")

people_lists("emilia-clarke", sort = "items")

## End(Not run)

Get the cast and crew of a show or movie

Description

Returns all cast and crew for a show/movie, depending on how much data is available.

Usage

movies_people(id, extended = c("min", "full"))

shows_people(id, guest_stars = FALSE, extended = c("min", "full"))

seasons_people(
  id,
  season = 1L,
  guest_stars = FALSE,
  extended = c("min", "full")
)

episodes_people(
  id,
  season = 1L,
  episode = 1L,
  guest_stars = FALSE,
  extended = c("min", "full")
)

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.

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.

guest_stars

logical(1) ["FALSE"]: Also include guest stars. This returns a lot of data, so use with care.

season, episode

integer(1) [1L]: The season and eisode number. If longer, e.g. 1:5, the function is vectorized and the output will be combined. This may result in a lot of API calls. Use wisely.

Value

A list of one or more tibbles for cast and/or crew. The latter tibble objects are as flat as possible.

Note

As of 2019-09-30, there are two representations of character[s] and job[s]: One is a regular character variable, and the other is a list-column. The former is deprecated and only included for compatibility reasons.

Source

movies_people() wraps endpoint movies/:id/people.

shows_people() wraps endpoint shows/:id/people.

seasons_people() wraps endpoint shows/:id/seasons/:season/people.

episodes_people() wraps endpoint shows/:id/seasons/:season/episodes/:episode/people.

See Also

people_media, for the other direction: People that have credits in shows/movies.

Other people data: media_lists, people_media(), people_summary()

Other movie data: anticipated_media, collected_media, media_aliases, media_comments, media_lists, media_ratings(), media_stats(), media_translations, media_watching, movies_boxoffice(), movies_related(), movies_releases(), movies_summary(), people_media(), played_media, popular_media, trending_media, watched_media

Other people data: media_lists, people_media(), people_summary()

Other show data: collected_media, media_aliases, media_comments, media_lists, media_ratings(), media_stats(), media_translations, media_watching, people_media(), played_media, shows_next_episode(), shows_related(), shows_summary()

Other people data: media_lists, people_media(), people_summary()

Other season data: media_comments, media_lists, media_ratings(), media_stats(), seasons_season(), seasons_summary()

Other people data: media_lists, people_media(), people_summary()

Other episode data: episodes_summary(), media_comments, media_lists, media_ratings(), media_stats(), media_translations, media_watching, seasons_season(), seasons_summary(), shows_next_episode()

Other people data: media_lists, people_media(), people_summary()

Examples

## Not run: 
movies_people("deadpool-2016")
shows_people("breaking-bad")
seasons_people("breaking-bad", season = 1)
episodes_people("breaking-bad", season = 1, episode = 1)

## End(Not run)

Media user ratings

Description

Returns a movie's or show's (or season's, or episode's) rating and ratings distribution. If you do not want the full ratings distribution, it is highly advised to just use ⁠*_summary⁠ functions or seasons_season for episode ratings.

Usage

shows_ratings(id)

movies_ratings(id)

seasons_ratings(id, season = 1L)

episodes_ratings(id, season = 1L, episode = 1L)

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.

season, episode

integer(1) [1L]: The season and eisode number. If longer, e.g. 1:5, the function is vectorized and the output will be combined. This may result in a lot of API calls. Use wisely.

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.

Note

Since this function is able to work on multi-length inputs for id, season and episode, it is possible to get a lot of data, but at the cost of one API call per element in each argument. Please be kind to the API.

Source

shows_ratings() wraps endpoint shows/:ids/ratings.

movies_ratings() wraps endpoint movies/:id/ratings.

seasons_ratings() wraps endpoint shows/:id/seasons/:season/ratings.

episodes_ratings() wraps endpoint shows/:id/seasons/:season/episodes/:episode/ratings.

See Also

Other show data: collected_media, media_aliases, media_comments, media_lists, media_people, media_stats(), media_translations, media_watching, people_media(), played_media, shows_next_episode(), shows_related(), shows_summary()

Other movie data: anticipated_media, collected_media, media_aliases, media_comments, media_lists, media_people, media_stats(), media_translations, media_watching, movies_boxoffice(), movies_related(), movies_releases(), movies_summary(), people_media(), played_media, popular_media, trending_media, watched_media

Other season data: media_comments, media_lists, media_people, media_stats(), seasons_season(), seasons_summary()

Other episode data: episodes_summary(), media_comments, media_lists, media_people, media_stats(), media_translations, media_watching, seasons_season(), seasons_summary(), shows_next_episode()

Examples

# A movie's ratings
movies_ratings("tron-legacy-2010")

# A show's ratings
shows_ratings("game-of-thrones")
## Not run: 
# Ratings for seasons 1 through 5
seasons_ratings("futurama", season = 1:5)

# Ratings for episodes 1 through 7 of season 1
episodes_ratings("futurama", season = 1, episode = 1:7)

## End(Not run)

Get a show or movie's (or season's or episode's) stats

Description

The data contains watchers, playes, collectors, comments, lists, and votes.

Usage

shows_stats(id)

movies_stats(id)

seasons_stats(id, season = 1L)

episodes_stats(id, season = 1L, episode = 1L)

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.

season, episode

integer(1) [1L]: The season and eisode number. If longer, e.g. 1:5, the function is vectorized and the output will be combined. This may result in a lot of API calls. Use wisely.

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.

Source

shows_stats() wraps endpoint shows/:id/stats.

movies_stats() wraps endpoint movies/:id/stats.

seasons_stats() wraps endpoint shows/:id/seasons/:season/stats.

episodes_stats() wraps endpoint shows/:id/seasons/:season/episodes/:episode/stats.

See Also

Other show data: collected_media, media_aliases, media_comments, media_lists, media_people, media_ratings(), media_translations, media_watching, people_media(), played_media, shows_next_episode(), shows_related(), shows_summary()

Other movie data: anticipated_media, collected_media, media_aliases, media_comments, media_lists, media_people, media_ratings(), media_translations, media_watching, movies_boxoffice(), movies_related(), movies_releases(), movies_summary(), people_media(), played_media, popular_media, trending_media, watched_media

Other season data: media_comments, media_lists, media_people, media_ratings(), seasons_season(), seasons_summary()

Other episode data: episodes_summary(), media_comments, media_lists, media_people, media_ratings(), media_translations, media_watching, seasons_season(), seasons_summary(), shows_next_episode()

Examples

# Stats for a movie
movies_stats("inception-2010")
## Not run: 
# Stats for multiple shows at once
shows_stats(c("breaking-bad", "game-of-thrones"))

# Stats for multiple episodes
episodes_stats("futurama", season = 1, episode = 1:7)

## End(Not run)

Get translations for a movie, show or episode

Description

Get translations for a movie, show or episode

Usage

movies_translations(id, languages = NULL)

shows_translations(id, languages = NULL)

episodes_translations(id, season = 1L, episode = 1L, languages = NULL)

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.

languages

character(n): Two-letter language code(s). Also see trakt_languages for available languages (code and name).

season, episode

integer(1) [1L]: The season and eisode number. If longer, e.g. 1:5, the function is vectorized and the output will be combined. This may result in a lot of API calls. Use wisely.

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.

Source

movies_translations() wraps endpoint movies/:id/translations/:language.

shows_translations() wraps endpoint shows/:id/translations/:language.

episodes_translations() wraps endpoint shows/:id/seasons/:season/episodes/:episode/translations/:language.

See Also

Other movie data: anticipated_media, collected_media, media_aliases, media_comments, media_lists, media_people, media_ratings(), media_stats(), media_watching, movies_boxoffice(), movies_related(), movies_releases(), movies_summary(), people_media(), played_media, popular_media, trending_media, watched_media

Other show data: collected_media, media_aliases, media_comments, media_lists, media_people, media_ratings(), media_stats(), media_watching, people_media(), played_media, shows_next_episode(), shows_related(), shows_summary()

Other episode data: episodes_summary(), media_comments, media_lists, media_people, media_ratings(), media_stats(), media_watching, seasons_season(), seasons_summary(), shows_next_episode()

Examples

# Get all translations
movies_translations("193972")

# Only get a specific language
movies_translations("193972", "de")

Get who's watching a thing right now

Description

Get who's watching a thing right now

Usage

movies_watching(id, extended = c("min", "full"))

shows_watching(id, extended = c("min", "full"))

seasons_watching(id, season = 1L, extended = c("min", "full"))

episodes_watching(id, season = 1L, episode = 1L, extended = c("min", "full"))

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.

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.

season, episode

integer(1) [1L]: The season and eisode number. If longer, e.g. 1:5, the function is vectorized and the output will be combined. This may result in a lot of API calls. Use wisely.

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.

Functions

  • movies_watching(): Who's watching a movie.

  • shows_watching(): Who's watching a show.

  • seasons_watching(): Who's watching a season.

  • episodes_watching(): Who's watching an episode.

Source

movies_watching() wraps endpoint movies/:id/watching.

shows_watching() wraps endpoint shows/:id/watching.

episodes_watching() wraps endpoint shows/:id/seasons/:season/episodes/:episode/watching.

See Also

Other movie data: anticipated_media, collected_media, media_aliases, media_comments, media_lists, media_people, media_ratings(), media_stats(), media_translations, movies_boxoffice(), movies_related(), movies_releases(), movies_summary(), people_media(), played_media, popular_media, trending_media, watched_media

Other show data: collected_media, media_aliases, media_comments, media_lists, media_people, media_ratings(), media_stats(), media_translations, people_media(), played_media, shows_next_episode(), shows_related(), shows_summary()

Other episode data: episodes_summary(), media_comments, media_lists, media_people, media_ratings(), media_stats(), media_translations, seasons_season(), seasons_summary(), shows_next_episode()

Examples

## Not run: 
movies_watching("deadpool-2016")
shows_watching("the-simpsons")
seasons_watching("the-simpsons", season = 6)
episodes_watching("the-simpsons", season = 6, episode = 12)

## End(Not run)

Get the weekend box office

Description

Returns the top 10 grossing movies in the U.S. box office last weekend. Updated every Monday morning.

Usage

movies_boxoffice(extended = c("min", "full"))

Arguments

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.

Source

movies_boxoffice() wraps endpoint movies/boxoffice.

See Also

Other movie data: anticipated_media, collected_media, media_aliases, media_comments, media_lists, media_people, media_ratings(), media_stats(), media_translations, media_watching, movies_related(), movies_releases(), movies_summary(), people_media(), played_media, popular_media, trending_media, watched_media

Examples

movies_boxoffice()

Get a movie's release details

Description

Retrieve one or more movie's release information, including the release date, country code (two letter, e.g. us), and the certification (e.g. PG).

Usage

movies_releases(id, country = NULL)

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.

country

Optional two letter country code to filter by. See trakt_countries for a table of country codes.

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.

Source

movies_releases() wraps endpoint movies/:id/releases/:country.

See Also

Other movie data: anticipated_media, collected_media, media_aliases, media_comments, media_lists, media_people, media_ratings(), media_stats(), media_translations, media_watching, movies_boxoffice(), movies_related(), movies_summary(), people_media(), played_media, popular_media, trending_media, watched_media

Examples

## Not run: 
movies_releases("tron-legacy-2010")

## End(Not run)

Get a single movie

Description

Get a single movie

Usage

movies_summary(id, extended = c("min", "full"))

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.

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.

Source

movies_summary() wraps endpoint movies/:id.

See Also

Other movie data: anticipated_media, collected_media, media_aliases, media_comments, media_lists, media_people, media_ratings(), media_stats(), media_translations, media_watching, movies_boxoffice(), movies_related(), movies_releases(), people_media(), played_media, popular_media, trending_media, watched_media

Other summary methods: comments_comment(), episodes_summary(), people_summary(), seasons_summary(), shows_summary(), user_profile()

Examples

# Minimal info by default
movies_summary("inception-2010")
## Not run: 
# Full information,  multiple movies
movies_summary(c("inception-2010", "the-dark-knight-2008"), extended = "full")

## End(Not run)

Easy episode number padding

Description

Simple function to ease the creation of sXXeYY episode ids. Note that s and e must have the same length.

Usage

pad_episode(s = "0", e = "0", s_width = 2, e_width = 2)

Arguments

s

Input season number, coerced to character.

e

Input episode number, coerced to character.

s_width

The length of the season number padding. Defaults to 2.

e_width

The length of the episode number padding. Defaults to 2.

Value

A character in the common sXXeYY format

Note

I like my sXXeYY format, okay?

See Also

Other utility functions: build_trakt_url()

Examples

# Season 2, episode 4
pad_episode(2, 4)
pad_episode(1, 85, e_width = 3)

Get a single person's movie or show credits

Description

Returns all movies or shows where this person is in the cast or crew.

Usage

people_movies(id, extended = c("min", "full"))

people_shows(id, extended = c("min", "full"))

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.

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.

Details

Note that as of 2019-09-30, there are two representations of character[s] and job[s]: One is a regular character variable, and the other is a list-column. The singular is deprecated and only included for compatibility reasons.

Value

A list of one or more tibbles for cast and crew. The latter tibble objects are as flat as possible.

Source

people_movies() wraps endpoint people/:id/movies.

people_shows() wraps endpoint people/:id/shows.

See Also

media_people, for the other direction: Media that has people.

Other movie data: anticipated_media, collected_media, media_aliases, media_comments, media_lists, media_people, media_ratings(), media_stats(), media_translations, media_watching, movies_boxoffice(), movies_related(), movies_releases(), movies_summary(), played_media, popular_media, trending_media, watched_media

Other people data: media_lists, media_people, people_summary()

Other show data: collected_media, media_aliases, media_comments, media_lists, media_people, media_ratings(), media_stats(), media_translations, media_watching, played_media, shows_next_episode(), shows_related(), shows_summary()

Other people data: media_lists, media_people, people_summary()

Examples

## Not run: 
people_movies("christopher-nolan")

people_shows("kit-harington")

## End(Not run)

Get a single person's details

Description

Get a single person's details, like their various IDs. If extended is "full", there will also be biographical data if available, e.g. their birthday.

Usage

people_summary(id, extended = c("min", "full"))

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.

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.

Source

people_summary() wraps endpoint people/:id.

See Also

Other people data: media_lists, media_people, people_media()

Other summary methods: comments_comment(), episodes_summary(), movies_summary(), seasons_summary(), shows_summary(), user_profile()

Examples

# A single person's extended information
people_summary("bryan-cranston", "full")

# Multiple people
people_summary(c("kit-harington", "emilia-clarke"))

Most played media

Description

These functions return the most played movies/shows on trakt.tv.

Usage

movies_played(
  limit = 10,
  extended = c("min", "full"),
  period = c("weekly", "monthly", "yearly", "all"),
  query = NULL,
  years = NULL,
  genres = NULL,
  languages = NULL,
  countries = NULL,
  runtimes = NULL,
  ratings = NULL,
  certifications = NULL
)

shows_played(
  limit = 10,
  extended = c("min", "full"),
  period = c("weekly", "monthly", "yearly", "all"),
  query = NULL,
  years = NULL,
  genres = NULL,
  languages = NULL,
  countries = NULL,
  runtimes = NULL,
  ratings = NULL,
  certifications = NULL,
  networks = NULL,
  status = NULL
)

Arguments

limit

integer(1) [10L]: Number of items to return. Must be greater than 0 and will be coerced via as.integer().

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.

period

character(1) ["weekly"]: Which period to filter by. Possible values are "weekly", "monthly", "yearly", "all".

query

character(1): Search string for titles and descriptions. For search_query() other fields are searched depending on the type of media. See the API docs for a full reference.

years

character | integer: 4-digit year (2010) or range, e.g. "2010-2020". Can also be an integer vector of length two which will be coerced appropriately, e.g. c(2010, 2020).

genres

character(n): Genre slug(s). See trakt_genres for a table of genres. Multiple values are allowed and will be concatenated.

languages

character(n): Two-letter language code(s). Also see trakt_languages for available languages (code and name).

countries

character(n): Two-letter country code(s). See trakt_countries.

runtimes

character | integer: Integer range in minutes, e.g. 30-90. Can also be an integer vector of length two which will be coerced appropriately.

ratings

character | integer: Integer range between 0 and 100. Can also be an integer vector of length two which will be coerced appropriately. Note that user-supplied ratings are in the range of 1 to 10, yet the ratings on the site itself are scaled to the range of 1 to 100.

certifications

character(n): Certification(s) like pg-13. Multiple values are allowed. Use trakt_certifications for reference. Note that there are different certifications for shows and movies.

networks

character(n): (Shows only) Network name like HBO. See trakt_networks for a list of known networks.

status

character(n): (Shows only) The status of the shows. One of "returning series", "in production", "planned", "canceled", or "ended".

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.

The Dynamic Lists on trakt.tv

These functions access the automatically updated lists provided by trakt.tv. Each function comes in two flavors: Shows or movies. The following descriptions are adapted directly from the API reference.

  • Popular: Popularity is calculated using the rating percentage and the number of ratings.

  • Trending: Returns all movies/shows being watched right now. Movies/shows with the most users are returned first.

  • Played: Returns the most played (a single user can watch multiple times) movies/shows in the specified time period.

  • Watched: Returns the most watched (unique users) movies/shows in the specified time period.

  • Collected: Returns the most collected (unique users) movies/shows in the specified time period.

  • Anticipated: Returns the most anticipated movies/shows based on the number of lists a movie/show appears on. The functions for Played, Watched, Collected and Played each return the same additional variables besides the media information: watcher_count, play_count, collected_count, collector_count.

Source

movies_played() wraps endpoint movies/played/:period.

shows_played() wraps endpoint shows/played/:period.

See Also

Other movie data: anticipated_media, collected_media, media_aliases, media_comments, media_lists, media_people, media_ratings(), media_stats(), media_translations, media_watching, movies_boxoffice(), movies_related(), movies_releases(), movies_summary(), people_media(), popular_media, trending_media, watched_media

Other dynamic lists: anticipated_media, collected_media, lists_popular(), popular_media, trending_media, watched_media

Other show data: collected_media, media_aliases, media_comments, media_lists, media_people, media_ratings(), media_stats(), media_translations, media_watching, people_media(), shows_next_episode(), shows_related(), shows_summary()

Other dynamic lists: anticipated_media, collected_media, lists_popular(), popular_media, trending_media, watched_media


Search trakt.tv via text query or ID

Description

Search for a show or movie with a keyword (e.g. "Breaking Bad") and receive basic info of the first search result. It's main use is to retrieve the IDs or proper show/movie title for further use, as well as receiving a quick overview of a show/movie.

Usage

search_query(
  query,
  type = "show",
  n_results = 1L,
  extended = c("min", "full"),
  years = NULL,
  genres = NULL,
  languages = NULL,
  countries = NULL,
  runtimes = NULL,
  ratings = NULL,
  certifications = NULL,
  networks = NULL,
  status = NULL
)

search_id(
  id,
  id_type = c("trakt", "imdb", "tmdb", "tvdb"),
  type = "show",
  n_results = 1L,
  extended = c("min", "full")
)

Arguments

query

character(1): Search string for titles and descriptions. For search_query() other fields are searched depending on the type of media. See the API docs for a full reference.

type

character(1) ["show"]: The type of data you're looking for. One of show, movie, episode, person or list or a character vector with those elements, e.g. c("show", "movie"). Note that not every combination is reasonably combinable, e.g. c("movie", "list"). Use separate function calls in that case.

n_results

integer(1) [1]: How many results to return.

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.

years

character | integer: 4-digit year (2010) or range, e.g. "2010-2020". Can also be an integer vector of length two which will be coerced appropriately, e.g. c(2010, 2020).

genres

character(n): Genre slug(s). See trakt_genres for a table of genres. Multiple values are allowed and will be concatenated.

languages

character(n): Two-letter language code(s). Also see trakt_languages for available languages (code and name).

countries

character(n): Two-letter country code(s). See trakt_countries.

runtimes

character | integer: Integer range in minutes, e.g. 30-90. Can also be an integer vector of length two which will be coerced appropriately.

ratings

character | integer: Integer range between 0 and 100. Can also be an integer vector of length two which will be coerced appropriately. Note that user-supplied ratings are in the range of 1 to 10, yet the ratings on the site itself are scaled to the range of 1 to 100.

certifications

character(n): Certification(s) like pg-13. Multiple values are allowed. Use trakt_certifications for reference. Note that there are different certifications for shows and movies.

networks

character(n): (Shows only) Network name like HBO. See trakt_networks for a list of known networks.

status

character(n): (Shows only) The status of the shows. One of "returning series", "in production", "planned", "canceled", or "ended".

id

character(1): The id used for the search, e.g. 14701 for a ⁠Trakt ID⁠.

id_type

character(1) ["trakt"]: The type of id. One of trakt, imdb, tmdb, tvdb.

Details

The amount of information returned is equal to ⁠*_summary⁠ API methods and in turn depends on the value of extended. See also the API reference here for which fields of the item metadata are searched by default.

Value

A tibble containing n_results results. Variable type is equivalent to the value of the type argument, and variable score indicates the search match, where 1000 is a perfect match. If no results are found, the tibble has 0 rows. If more than one type is specified, e.g. c("movie", "show"), there will be n_results results per type.

Source

search_query() wraps endpoint search/:type?query=.

search_id() wraps endpoint search/:id_type/:id?type=.

Examples

# A show
search_query("Breaking Bad", type = "show", n_results = 3)
## Not run: 
# A show by its trakt id, and now with more information
search_id(1388, "trakt", type = "show", extended = "full")

# A person
search_query("J. K. Simmons", type = "person", extended = "full")

# A movie or a show, two of each
search_query("Tron", type = c("movie", "show"), n_results = 2)

## End(Not run)

Get a season of a show

Description

Similar to seasons_summary, but this function returns full data for a single season, i.e. all the episodes of the season

Usage

seasons_season(id, seasons = 1L, extended = c("min", "full"))

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.

seasons

integer(1) [1L]: The season(s) to get. Use 0 for specials.

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.

Note

If you want to quickly gather episode data of all available seasons, see seasons_summary and use the episodes = TRUE parameter.

Source

seasons_season() wraps endpoint shows/id/seasons/season.

See Also

Other season data: media_comments, media_lists, media_people, media_ratings(), media_stats(), seasons_summary()

Other episode data: episodes_summary(), media_comments, media_lists, media_people, media_ratings(), media_stats(), media_translations, media_watching, seasons_summary(), shows_next_episode()

Examples

## Not run: 
seasons_season("breaking-bad", 1)

# Including all episode data:
seasons_season("breaking-bad", 1, extended = "full")

## End(Not run)

Get a show's seasons

Description

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")
)

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.

Source

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

See Also

Other season data: media_comments, media_lists, media_people, media_ratings(), media_stats(), seasons_season()

Other episode data: episodes_summary(), media_comments, media_lists, media_people, media_ratings(), media_stats(), media_translations, media_watching, seasons_season(), shows_next_episode()

Other summary methods: comments_comment(), episodes_summary(), movies_summary(), people_summary(), shows_summary(), user_profile()

Examples

# Get just the season numbers and their IDs
seasons_summary("breaking-bad", extended = "min")
## Not run: 
# 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)

## End(Not run)

Get a shows next or latest episode

Description

Get a shows next or latest episode

Usage

shows_next_episode(id, extended = c("min", "full"))

shows_last_episode(id, extended = c("min", "full"))

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.

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.

Source

shows_next_episode() wraps endpoint shows/:id/next_episode.

shows_last_episode() wraps endpoint shows/:id/last_episode.

See Also

Other show data: collected_media, media_aliases, media_comments, media_lists, media_people, media_ratings(), media_stats(), media_translations, media_watching, people_media(), played_media, shows_related(), shows_summary()

Other episode data: episodes_summary(), media_comments, media_lists, media_people, media_ratings(), media_stats(), media_translations, media_watching, seasons_season(), seasons_summary()

Other show data: collected_media, media_aliases, media_comments, media_lists, media_people, media_ratings(), media_stats(), media_translations, media_watching, people_media(), played_media, shows_related(), shows_summary()

Other episode data: episodes_summary(), media_comments, media_lists, media_people, media_ratings(), media_stats(), media_translations, media_watching, seasons_season(), seasons_summary()

Examples

shows_next_episode("one-piece")
shows_last_episode("one-piece", extended = "full")

Get a single show

Description

Get a single show

Usage

shows_summary(id, extended = c("min", "full"))

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.

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.

Source

shows_summary() wraps endpoint shows/:id.

See Also

Other show data: collected_media, media_aliases, media_comments, media_lists, media_people, media_ratings(), media_stats(), media_translations, media_watching, people_media(), played_media, shows_next_episode(), shows_related()

Other summary methods: comments_comment(), episodes_summary(), movies_summary(), people_summary(), seasons_summary(), user_profile()

Examples

# Minimal info by default
shows_summary("breaking-bad")
## Not run: 
# More information
shows_summary("breaking-bad", extended = "full")

## End(Not run)

Set the required trakt.tv API credentials

Description

trakt_credentials searches for your credentials and stores them in the appropriate environment variables of the same name. To make this work automatically, place your key as environment variables in ⁠~/.Renviron⁠ (see Details). Arguments to this function take precedence over any configuration file.

Usage

trakt_credentials(username, client_id, client_secret, silent = TRUE)

Arguments

username

character(1): Explicitly set your trakt.tv username (optional).

client_id

character(1): Explicitly set your API client ID (required for any API interaction).

client_secret

character(1): Explicitly set your API client secret (required only for authenticated API interaction).

silent

logical(1) [TRUE]: No messages are printed showing you the API information. Mostly for debug purposes.

Details

This function is called automatically when the package is loaded via library(tRakt) or tRakt::fun function calls – you basically never have to use it if you have stored your credentials as advised. Additionally, for regular (non-authenticated) API interaction, you do not have to set any credentials at all because the package's client_secret is used as a fallback, which allows you to use most functions out of the box.

Set appropriate values in your ⁠~/.Renviron⁠ like this:

# tRakt
trakt_username=jemus42
trakt_client_id=12[...]f2
trakt_client_secret=f23[...]2nkjb

If (and only if) the environment option trakt_client_secret is set to a non-empty string (i.e. it's not ""), then all requests will be made using authentication.

Value

Invisibly: A list with elements username, client_id and client_secret, where values are TRUE if the corresponding value is non-empty.

See Also

Other API-basics: trakt_get(), trakt_get_token()

Examples

## Not run: 
# Use a values set in ~/.Renviron in an R session:
# (This is automatically executed when calling library(tRakt))
trakt_credentials(silent = FALSE)

# Explicitly set values in an R session, overriding .Renviron values
trakt_credentials(
  username = "jemus42",
  client_id = "totallylegitclientsecret",
  silent = FALSE
)

## End(Not run)

Cached filter datasets

Description

These datasets are used internally to check the optional filter parameters for certain functions (see search_query or the dynamic lists like shows_popular). They are unlikely to change often and are therefore included as package datasets.

Usage

trakt_genres

trakt_languages

trakt_networks

trakt_countries

trakt_certifications

Format

Every dataset is a tibble(). The following list includes the dataset topic with a link to the API documentation, a short description and a list of variables with example values:

  • Genres: Genres for shows and movies (with their two-letter codes) trakt.tv knows.

    • 3 Variables: name ("Action"), slug ("action"), type ("movies")

  • Languages: Languages (and two-letter codes) trakt.tv knows.

    • 3 Variables: name ("Arabic"), code ("ar"), type ("movies")

  • Networks: TV networks trakt.tv knows.

    • 2 Variables: name ("TBS"), name_clean ("tbs") (lower-case, no trailing whitespaces)

  • Countries: Country names (and two-letter codes).

    • 3 Variables: name ("Belarus"), code ("by"), type ("movies")

  • Certifications: TV and movie certifications (e.g. "PG-13" and the likes).

    • 5 Variables: country ("us" only), name ("TV-PG"), slug ("tv-pg"), description ("Parental Guidance Suggested"), type ("shows")

An object of class tbl_df (inherits from tbl, data.frame) with 64 rows and 3 columns.

An object of class tbl_df (inherits from tbl, data.frame) with 244 rows and 3 columns.

An object of class tbl_df (inherits from tbl, data.frame) with 3081 rows and 2 columns.

An object of class tbl_df (inherits from tbl, data.frame) with 350 rows and 3 columns.

An object of class tbl_df (inherits from tbl, data.frame) with 12 rows and 5 columns.

Details

The datasets are prefixed with trakt_ purely to avoid confusion or masking for filter arguments of the same name.

Note

Currently only US certifications are available.

Examples

head(trakt_genres)
head(trakt_languages)
head(trakt_networks)
head(trakt_countries)
trakt_certifications

Make an API call and receive parsed output

Description

The most basic form of API interaction: Querying a specific URL and getting its parsed result. If the response is empty, the function returns an empty tibble(), and if there are date-time variables present in the response, they are converted to POSIXct via lubridate::ymd_hms() or to Date via lubridate::as_date() if the variable only contains date information.

Usage

trakt_get(url, client_id = Sys.getenv("trakt_client_id"), HEAD = FALSE)

Arguments

url

character(1): The API endpoint. Either a full URL like "https://api.trakt.tv/shows/breaking-bad" or just the endpoint like shows/breaking-bad.

client_id

character(1): API client ID. If no value is set, this defaults to the package's client ID. See trakt_credentials for further information.

HEAD

logical(1) [FALSE]: If TRUE, only a HTTP HEAD request is performed and its content returned. This is useful if you are only interested in status codes or other headers, and don't want to waste resources/bandwidth on the response body.

Details

See the official API reference for a detailed overview of available methods. Most methods of potential interest for data collection have dedicated functions in this package.

Value

The parsed (jsonlite::fromJSON()) content of the API response. An empty tibble() if the response is an empty JSON array.

Note

No OAuth2 methods are supported yet, meaning you don't have access to POST methods or user information of non-public profiles.

See Also

Other API-basics: trakt_credentials(), trakt_get_token()

Examples

# A simple request to a direct URL
trakt_get("https://api.trakt.tv/shows/breaking-bad")

# A HEAD-only request
# useful for validating a URL exists or the API is accessible
trakt_get("https://api.trakt.tv/users/jemus42", HEAD = TRUE)

# Optionally be lazy about URL specification by dropping the hostname:
trakt_get("shows/game-of-thrones")

Get a user's collected shows or movies

Description

Get a user's collected shows or movies

Usage

user_collection(
  user = getOption("trakt_username"),
  type = c("shows", "movies"),
  unnest_episodes = FALSE,
  extended = c("min", "full")
)

Arguments

user

character(1): Target username (or slug). Defaults to getOption("trakt_username"). Can also be of length greater than 1, in which case the function is called on all user values separately and the result is combined.

type

character(1): Either "shows" or "movies". For season/episode-specific functions, values seasons or episodes are also allowed.

unnest_episodes

logical(1) [FALSE]: Unnests episode data using tidyr::unnest() and returns one row per episode rather than one row per show.

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.

Details

This function wraps the API method ⁠/users/:user_id/collection/:type⁠.

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.

Note

The extended = "metadata" API parameter is not implemented. This would add media information media_type, resolution, audio, audio_channels and ⁠3D⁠ to the output, which may or may not be available. If this feature is important to you, please open an issue on GitHub.

Source

user_collection() wraps endpoint users/:id/collection/:type.

See Also

Other user data: user_comments(), user_history(), user_likes(), user_network(), user_profile(), user_ratings(), user_stats(), user_watched(), user_watchlist()

Examples

## Not run: 
user_collection(user = "sean", type = "movies")
user_collection(user = "sean", type = "shows")

## End(Not run)

Get a user's comments

Description

Get a user's comments

Usage

user_comments(
  user = getOption("trakt_username"),
  comment_type = c("all", "reviews", "shouts"),
  type = c("all", "movies", "shows", "seasons", "episodes", "lists"),
  include_replies = FALSE
)

Arguments

user

character(1): Target username (or slug). Defaults to getOption("trakt_username"). Can also be of length greater than 1, in which case the function is called on all user values separately and the result is combined.

comment_type

character(1) ["all"]: The type of comment, one of "all", "reviews" or "shouts".

type

character(1) ["all"]: The type of media to filter by, one of "all", "movies", "shows", "seasons", "episodes" or "lists".

include_replies

logical(1) [FALSE]: Whether to include replies.

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.

Source

user_comments() wraps endpoint users/:id/comments/:comment_type/:type?include_replies=.

See Also

Other user data: user_collection(), user_history(), user_likes(), user_network(), user_profile(), user_ratings(), user_stats(), user_watched(), user_watchlist()

Other comment methods: comments_comment(), comments_trending(), comments_updates(), media_comments, user_list_comments()

Examples

## Not run: 
user_comments("jemus42")

## End(Not run)

Get a user's watch history

Description

Retrieve a the last limit items a user has watched, including the method by which it was logged (e.g. scrobble or checkin).

Usage

user_history(
  user = getOption("trakt_username"),
  type = c("shows", "movies"),
  limit = 10L,
  start_at = NULL,
  end_at = NULL,
  extended = c("min", "full")
)

Arguments

user

character(1): Target username (or slug). Defaults to getOption("trakt_username"). Can also be of length greater than 1, in which case the function is called on all user values separately and the result is combined.

type

character(1): Either "shows" or "movies". For season/episode-specific functions, values seasons or episodes are also allowed.

limit

integer(1) [10L]: Number of items to return. Must be greater than 0 and will be coerced via as.integer().

start_at, end_at

character(1): A time-window to filter by. Must be coercible to a datetime object of class POSIXct. See ISOdate for further information.

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.

Details

This function wraps the API method ⁠/users/:id/history/:type⁠.

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.

Note

For type = "shows", the original output contains a nested object with show and episode data, which are unnested by this function. Due to duplicate variable names, all episode-related variables are prefixed with episode_. This results in the episode number having the name episode_episode, which is quite silly. Sorry.

Source

user_history() wraps endpoint users/:id/history/:type/:item_id?start_at=&end_at=.

See Also

Other user data: user_collection(), user_comments(), user_likes(), user_network(), user_profile(), user_ratings(), user_stats(), user_watched(), user_watchlist()

Examples

## Not run: 
# Shows user "jemus42" watched around christmas 2016
user_history(
  user = "jemus42", type = "shows", limit = 5,
  start_at = "2015-12-24", end_at = "2015-12-28"
)

## End(Not run)

Get items (comments, lists) a user likes

Description

Get items (comments, lists) a user likes

Usage

user_likes(type = c("comments", "lists"))

Arguments

type

character(1) ["comments"]: One of "comments", "lists".

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.

Source

user_likes() wraps endpoint users/likes/:type (Authentication required).

See Also

Other user data: user_collection(), user_comments(), user_history(), user_network(), user_profile(), user_ratings(), user_stats(), user_watched(), user_watchlist()

Examples

# Get liked lists (only if there's a client secret set)
# See ?trakt_credentials
if (trakt_credentials()[["client_secret"]]) {
  user_likes("lists")
}

Get a single list

Description

Retrieve a single list a user has created together with information about the user. Use extended = "full" to retrieve all user profile data, similiar to user_profile. The returned variables trakt (list ID) or slug (list slug) can be used to retrieve the list's items via user_list_items.

Usage

user_list(
  user = getOption("trakt_username"),
  list_id,
  extended = c("min", "full")
)

Arguments

user

character(1): Target username (or slug). Defaults to getOption("trakt_username"). Can also be of length greater than 1, in which case the function is called on all user values separately and the result is combined.

list_id

The list identifier, either trakt ID or slug of the list. Can be optained via the website (URL slug) or e.g. user_lists.

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.

Note

In the embedded user data, name is renamed to user_name due to duplication with e.g. list names, and slug is renamed to user_slug for the same reason.

See Also

user_list for only a single list.

user_list_items For the actual content of a list.

Other list methods: lists_popular(), media_lists, user_list_comments(), user_list_items(), user_lists()

Examples

## Not run: 
user_list("jemus42", list_id = 2121308)

## End(Not run)

Get comments on a user-created list

Description

Get comments on a user-created list

Usage

user_list_comments(
  user = getOption("trakt_username"),
  list_id,
  sort = c("newest", "oldest", "likes", "replies"),
  extended = c("min", "full")
)

Arguments

user

character(1): Target username (or slug). Defaults to getOption("trakt_username"). Can also be of length greater than 1, in which case the function is called on all user values separately and the result is combined.

list_id

The list identifier, either trakt ID or slug of the list. Can be optained via the website (URL slug) or e.g. user_lists.

sort

character(1) ["newest"]: Comment sort order, one of "newest", "oldest", "likes" or "replies".

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.

Source

user_list_comments() wraps endpoint users/:id/lists/:list_id/comments/:sort.

See Also

Other comment methods: comments_comment(), comments_trending(), comments_updates(), media_comments, user_comments()

Other list methods: lists_popular(), media_lists, user_list(), user_list_items(), user_lists()

Examples

## Not run: 
user_list_comments("donxy", "1248149")

## End(Not run)

Get a user's list's items

Description

Get a user's list's items

Usage

user_list_items(
  user = getOption("trakt_username"),
  list_id,
  type = NULL,
  extended = c("min", "full")
)

Arguments

user

character(1): Target username (or slug). Defaults to getOption("trakt_username"). Can also be of length greater than 1, in which case the function is called on all user values separately and the result is combined.

list_id

The list identifier, either trakt ID or slug of the list. Can be optained via the website (URL slug) or e.g. user_lists.

type

character(1) [NULL]: If not NULL, only items of that media type are returned. Possible values are "movie", "show", "season", "episode", "person".

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.

Source

user_list_items() wraps endpoint users/:id/lists/:list_id/items/:type.

See Also

Other list methods: lists_popular(), media_lists, user_list(), user_list_comments(), user_lists()

Examples

## Not run: 
# A large list with various media types
# All items
user_list_items("sp1ti", list_id = "5615781", extended = "min")

# Movies only
user_list_items("sp1ti", list_id = "5615781", extended = "min", type = "movie")

# Shows...
user_list_items("sp1ti", list_id = "5615781", extended = "min", type = "shows")

# Only seasons
user_list_items("sp1ti", list_id = "5615781", extended = "min", type = "season")

# Only episodes
user_list_items("sp1ti", list_id = "5615781", extended = "min", type = "episodes")

## End(Not run)

Get a user's lists

Description

Retrieve all lists a user has created together with information about the user. Use extended = "full" to retrieve all user profile data, similiar to user_profile. The returned variables trakt (list ID) or slug (list slug) can be used to retrieve the list's items via user_list_items.

Usage

user_lists(user = getOption("trakt_username"), extended = c("min", "full"))

Arguments

user

character(1): Target username (or slug). Defaults to getOption("trakt_username"). Can also be of length greater than 1, in which case the function is called on all user values separately and the result is combined.

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.

Note

In the embedded user data, name is renamed to user_name due to duplication with e.g. list names, and slug is renamed to user_slug for the same reason.

Source

user_lists() wraps endpoint users/:id/lists.

See Also

user_lists for all lists a user has.

user_list_items For the actual content of a list.

Other list methods: lists_popular(), media_lists, user_list(), user_list_comments(), user_list_items()

Examples

## Not run: 
user_lists("jemus42")

## End(Not run)

Get a user's social connections

Description

Get followers, followings or friends (the two-way relationship).

Usage

user_followers(user = getOption("trakt_user"), extended = "min")

user_following(user = getOption("trakt_user"), extended = "min")

user_friends(user = getOption("trakt_user"), extended = "min")

Arguments

user

character(1): Target username (or slug). Defaults to getOption("trakt_username"). Can also be of length greater than 1, in which case the function is called on all user values separately and the result is combined.

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.

Note

If the specified user is private, you need to be able to make an authenticated request and be friends with the user.

Source

user_followers() wraps endpoint users/:id/followers.

user_following() wraps endpoint users/:id/following.

user_friends() wraps endpoint users/:id/friends.

See Also

Other user data: user_collection(), user_comments(), user_history(), user_likes(), user_profile(), user_ratings(), user_stats(), user_watched(), user_watchlist()

Examples

## Not run: 
user_followers(user = "sean")

## End(Not run)
## Not run: 
user_following(user = "sean")

## End(Not run)
## Not run: 
user_friends(user = "sean")

## End(Not run)

Get a user's profile

Description

Get a user's profile

Usage

user_profile(user = getOption("trakt_username"), extended = c("min", "full"))

Arguments

user

character(1): Target username (or slug). Defaults to getOption("trakt_username"). Can also be of length greater than 1, in which case the function is called on all user values separately and the result is combined.

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.

Note

If the specified user is private, you need to be able to make an authenticated request and be friends with the user.

Source

user_profile() wraps endpoint users/:id.

See Also

Other user data: user_collection(), user_comments(), user_history(), user_likes(), user_network(), user_ratings(), user_stats(), user_watched(), user_watchlist()

Other summary methods: comments_comment(), episodes_summary(), movies_summary(), people_summary(), seasons_summary(), shows_summary()

Examples

## Not run: 
user_profile("sean")

## End(Not run)

Get a user's ratings

Description

Retrieve a user's media ratings

Usage

user_ratings(
  user = getOption("trakt_username"),
  type = c("movies", "seasons", "shows", "episodes"),
  rating = NULL,
  extended = c("min", "full")
)

Arguments

user

character(1): Target username (or slug). Defaults to getOption("trakt_username"). Can also be of length greater than 1, in which case the function is called on all user values separately and the result is combined.

type

character(1): Either "shows" or "movies". For season/episode-specific functions, values seasons or episodes are also allowed.

rating

integer(1) [NULL]: Optional rating between 1 and 10 to filter by.

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.

Source

user_ratings() wraps endpoint users/:id/ratings/:type/:rating.

See Also

Other user data: user_collection(), user_comments(), user_history(), user_likes(), user_network(), user_profile(), user_stats(), user_watched(), user_watchlist()

Examples

## Not run: 
user_ratings(user = "jemus42", "shows")
user_ratings(user = "sean", type = "movies")

## End(Not run)

Returns stats about the movies, shows, and episodes a user has watched, collected, and rated.

Description

Data about a user's interactions with movies, shows, seasons, episodes, as well as their social network (friends, followings, followers) and a frequency table of the user's media ratings so far.

Usage

user_stats(user = getOption("trakt_username"))

Arguments

user

character(1): Target username (or slug). Defaults to getOption("trakt_username"). Can also be of length greater than 1, in which case the function is called on all user values separately and the result is combined.

Value

A list of tibbles containing the following elements:

  • "movies"

  • "shows"

  • "seasons"

  • "episodes"

  • "network"

  • "ratings"

Source

user_stats() wraps endpoint users/:id/stats.

See Also

Other user data: user_collection(), user_comments(), user_history(), user_likes(), user_network(), user_profile(), user_ratings(), user_watched(), user_watchlist()

Examples

## Not run: 
user_stats(user = "sean")

## End(Not run)

Get a user's watched shows or movies

Description

For private users, an authenticated request is required.

Usage

user_watched(
  user = getOption("trakt_username"),
  type = c("shows", "movies"),
  noseasons = TRUE,
  extended = c("min", "full")
)

Arguments

user

character(1): Target username (or slug). Defaults to getOption("trakt_username"). Can also be of length greater than 1, in which case the function is called on all user values separately and the result is combined.

type

character(1): Either "shows" or "movies". For season/episode-specific functions, values seasons or episodes are also allowed.

noseasons

logical(1) [TRUE]: Only for type = "show": Exclude detailed season data from output. This is advisable if you do not need per-episode data and want to be nice to the API.

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.

Source

user_watched() wraps endpoint users/:id/watched/:type.

See Also

Other user data: user_collection(), user_comments(), user_history(), user_likes(), user_network(), user_profile(), user_ratings(), user_stats(), user_watchlist()

Examples

## Not run: 
# Use noseasons = TRUE to avoid receiving detailed season/episode data
user_watched(user = "sean", noseasons = TRUE)

## End(Not run)

Get a user's watchlist

Description

Get a user's watchlist

Usage

user_watchlist(
  user = getOption("trakt_username"),
  type = c("movies", "shows"),
  extended = c("min", "full")
)

Arguments

user

character(1): Target username (or slug). Defaults to getOption("trakt_username"). Can also be of length greater than 1, in which case the function is called on all user values separately and the result is combined.

type

character(1): Either "shows" or "movies". For season/episode-specific functions, values seasons or episodes are also allowed.

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.

Source

user_watchlist() wraps endpoint users/:id/watchlist/:type.

See Also

Other user data: user_collection(), user_comments(), user_history(), user_likes(), user_network(), user_profile(), user_ratings(), user_stats(), user_watched()

Examples

## Not run: 
# Defaults to movie watchlist and minimal info
user_watchlist(user = "sean")

## End(Not run)

Most watched media

Description

These functions return the most watched movies/shows on trakt.tv.

Usage

movies_watched(
  limit = 10,
  extended = c("min", "full"),
  period = c("weekly", "monthly", "yearly", "all"),
  query = NULL,
  years = NULL,
  genres = NULL,
  languages = NULL,
  countries = NULL,
  runtimes = NULL,
  ratings = NULL,
  certifications = NULL
)

shows_watched(
  limit = 10,
  extended = c("min", "full"),
  period = c("weekly", "monthly", "yearly", "all"),
  query = NULL,
  years = NULL,
  genres = NULL,
  languages = NULL,
  countries = NULL,
  runtimes = NULL,
  ratings = NULL,
  certifications = NULL,
  networks = NULL,
  status = NULL
)

Arguments

limit

integer(1) [10L]: Number of items to return. Must be greater than 0 and will be coerced via as.integer().

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.

period

character(1) ["weekly"]: Which period to filter by. Possible values are "weekly", "monthly", "yearly", "all".

query

character(1): Search string for titles and descriptions. For search_query() other fields are searched depending on the type of media. See the API docs for a full reference.

years

character | integer: 4-digit year (2010) or range, e.g. "2010-2020". Can also be an integer vector of length two which will be coerced appropriately, e.g. c(2010, 2020).

genres

character(n): Genre slug(s). See trakt_genres for a table of genres. Multiple values are allowed and will be concatenated.

languages

character(n): Two-letter language code(s). Also see trakt_languages for available languages (code and name).

countries

character(n): Two-letter country code(s). See trakt_countries.

runtimes

character | integer: Integer range in minutes, e.g. 30-90. Can also be an integer vector of length two which will be coerced appropriately.

ratings

character | integer: Integer range between 0 and 100. Can also be an integer vector of length two which will be coerced appropriately. Note that user-supplied ratings are in the range of 1 to 10, yet the ratings on the site itself are scaled to the range of 1 to 100.

certifications

character(n): Certification(s) like pg-13. Multiple values are allowed. Use trakt_certifications for reference. Note that there are different certifications for shows and movies.

networks

character(n): (Shows only) Network name like HBO. See trakt_networks for a list of known networks.

status

character(n): (Shows only) The status of the shows. One of "returning series", "in production", "planned", "canceled", or "ended".

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.

The Dynamic Lists on trakt.tv

These functions access the automatically updated lists provided by trakt.tv. Each function comes in two flavors: Shows or movies. The following descriptions are adapted directly from the API reference.

  • Popular: Popularity is calculated using the rating percentage and the number of ratings.

  • Trending: Returns all movies/shows being watched right now. Movies/shows with the most users are returned first.

  • Played: Returns the most played (a single user can watch multiple times) movies/shows in the specified time period.

  • Watched: Returns the most watched (unique users) movies/shows in the specified time period.

  • Collected: Returns the most collected (unique users) movies/shows in the specified time period.

  • Anticipated: Returns the most anticipated movies/shows based on the number of lists a movie/show appears on. The functions for Played, Watched, Collected and Played each return the same additional variables besides the media information: watcher_count, play_count, collected_count, collector_count.

Source

movies_watched() wraps endpoint movies/watched/:period.

shows_watched() wraps endpoint shows/watched/:period.

See Also

Other movie data: anticipated_media, collected_media, media_aliases, media_comments, media_lists, media_people, media_ratings(), media_stats(), media_translations, media_watching, movies_boxoffice(), movies_related(), movies_releases(), movies_summary(), people_media(), played_media, popular_media, trending_media

Other dynamic lists: anticipated_media, collected_media, lists_popular(), played_media, popular_media, trending_media

Other shows data: anticipated_media, popular_media, trending_media

Other dynamic lists: anticipated_media, collected_media, lists_popular(), played_media, popular_media, trending_media