Justwatch client
Ruby Client for JustWatch API
How to configure
If you are using Rails, the better way is to define an initializer in config/initializers
, defining the default locale and the token (we encourage to not push the token to the repo).
# config/initializers/justwatch.rb
JustWatch::Api.locale = 'es_ES'
JustWatch::Api.token = ENV.fetch('JUSTWATCH_API_TOKEN', nil)
The locale defined here is the default, you can override it in the different calls.
General Provider Info
We can fetch the data for providers with the following call:
JustWatch::Provider.list(locale:)
Parameter | Explanation | Example values |
---|
locale (optional) | Locale you are searching for | es_ES , en_US |
Genres list
We can fetch the genre list with the following call:
JustWatch::Genre.list(locale:)
Parameter | Explanation | Example values |
---|
locale (optional) | Locale you are searching for | es_ES , en_US |
Country list
We can fetch the country list with the following call:
JustWatch::Country.list(locale:)
Parameter | Explanation | Example values |
---|
locale (optional) | Locale you are searching for | es_ES , en_US |
Movie offers by ID
We can fetch the data for a movie using a service ID with the following call:
JustWatch::Movie.offers_by_id(id:, service_id_type:, locale:)
Parameter | Explanation | Example values |
---|
id | TMDB, IMDB or Justwatch ID | 12345 , tt0125439 , 39130 |
service_id_type | Service for which the ID has been provided | tmdb , imdb or justwatch |
locale (optional) | Locale you are searching for | es_ES , en_US |
Movie offers by title and year
We can fetch the data for a movie using title and year with the following call:
JustWatch::Movie.offers_by_title_and_year(title:, year:, locale: Api.locale)
Parameter | Explanation | Example values |
---|
title | Movie title | 12 monkeys , The Shining |
year | Movie release year | 1999 , 2021 |
locale (optional) | Locale you are searching for | es_ES , en_US |
TvShow offers by ID
We can fetch the data for a tv show using a service ID with the following call:
JustWatch::TvShow.offers_by_id(id:, service_id_type:, locale:)
Parameter | Explanation | Example values |
---|
id | TMDB, IMDB or Justwatch ID | 12345 , tt0125439 , 39130 |
service_id_type | Service for which the ID has been provided | tmdb , imdb or justwatch |
locale (optional) | Locale you are searching for | es_ES , en_US |
TvShow offers by title and year
We can fetch the data for a tv show using the tv show title and the year with the following call:
JustWatch::TvShow.offers_by_title_and_year(title:, year:, locale:)
Parameter | Explanation | Example values |
---|
title | Tv show title | House , Lost |
year | Tv show release year | 2004 , 2021 |
locale (optional) | Locale you are searching for | es_ES , en_US |
Season offers by id and season number
We can fetch the data for a season using the tv show ID and the season number with the following call:
JustWatch::Season.offers_by_id_and_season_number(id:, service_id_type:, season_number:, locale:)
Parameter | Explanation | Example values |
---|
id | TMDB, IMDB or Justwatch tv show ID | 12345 , tt0125439 , 39130 |
service_id_type | Service for which the ID has been provided | tmdb , imdb or justwatch |
locale (optional) | Locale you are searching for | es_ES , en_US |
Season offers by title, year and season number
We can fetch the data for a season using the tv show tv show title, year and season number with the following call:
JustWatch::Season::offers_by_title_year_and_season_number(title:, year:, season_number:, locale:)
Parameter | Explanation | Example values |
---|
title | Tv show title | House , Lost |
year | Tv show release year | 2004 , 2021 |
season_number | Tv show season number | 1 , 2 |
locale (optional) | Locale you are searching for | es_ES , en_US |
Troubleshoot
Locale
Your JustWatch account is restricted to a bunch of locales. If you are getting Unauthorized errors this could be the reason.