A basic and unofficial JustWatch API.
Since standard free JustWatch API was removed this one uses Selenium to gather responses from JustWatch website directly. It's slower than regular API would be, as Selenium has an execution time overhead.
Note
I've created a Python API which uses GraphQL queries to access data: simple-justwatch-python-api
.
It works much faster, returns a lot more information and is a lot simpler to use, as it doesn't require Selenium.
I recommend using it over this one.
This API is built using FastAPI
, Selenium
and Python 3.11
.
Full list of Python requirements is in requirements.txt
file.
Configuration is done through .env
file. You can use provided .env.example
as reference.
You can configure country used for JustWatch via COUNTRY
environment variable:
COUNTRY=US
Values are matching JustWatch URLs. By default US
is used.
You must configure paths for both Firefox and Firefox driver (geckodriver). Normally you could use Selenium Manager to figure out paths, unfortunately it doesn't support ARM64 (e.g. Raspberry PI). Specifying paths to both is a workaround disabling Manager:
FIREFOX_BIN=/path/to/firefox/binary
FIREFOX_DRIVER=/path/to/geckodriver
You can find geckodriver on its GitHub.
Docker (and Docker Compose) assumes that geckodriver is present in project root directory to copy it into images.
You can run the API through Docker Compose, only requirement is geckodriver present in project root:
docker compose up -d --build
Dockerfile will handle installing and setting up Firefox path and geckodriver path.
By default, Compose will forward local port 5031 to container port 8000, where the API is listening.
You can change both ports in docker-compose.yml
, just make sure, that environment variable UVICORN_PORT
matches new forwarded port on container side.
- Download geckodriver and make sure that Firefox is installed
- Optionally configure search country
- Set paths to geckodriver and Firefox in
.env
file - Install all Python packages from
requirements.txt
- Start the api via
uvicorn
setting upPYTHONPATH
to project root
echo "FIREFOX_BIN=/path/to/firefox" >> .env
echo "FIREFOX_DRIVER=/path/to/geckodriver" >> .env
pip install -r requirements.txt
PYTHONPATH=$PWD uvicorn src.main.py
Uvicorn will by default start the API on address 127.0.0.1:8000
, you can change it via --host <new host>
and --port <new port>
parameters.
More details are in Uvicorn documentation.
You can access docs (automatically generated) by /
or /redoc/
.
Besides docs there's only one endpoint:
/search/{item_name}
Where item_name
is your search query.
API responds with a JSON with first 5 found entries, e.g.:
[
[
"The Matrix",
"1999",
{
"Stream": [
[
"Max Amazon Channel",
"https://click.justwatch.com/super-long-just-watch-url-to-external-service",
"Subs HD"
],
[
"Max",
"https://click.justwatch.com/super-long-just-watch-url-to-external-service",
"Subs 4K"
]
],
"Rent": [
[
"Apple TV",
"https://click.justwatch.com/super-long-just-watch-url-to-external-service",
"$3.99 4K"
],
[
"Amazon Video",
"https://click.justwatch.com/super-long-just-watch-url-to-external-service",
"$3.99 4K"
]
],
"Buy": [
[
"Apple TV",
"https://click.justwatch.com/super-long-just-watch-url-to-external-service",
"$14.99 4K"
],
[
"Amazon Video",
"https://click.justwatch.com/super-long-just-watch-url-to-external-service",
"$14.99 HD"
]
]
}
],
[
"The Matrix Resurrections",
"2021",
{
"Rent": [
[
"Amazon Video",
"https://click.justwatch.com/super-long-just-watch-url-to-external-service",
"$3.79 4K"
],
[
"Apple TV",
"https://click.justwatch.com/super-long-just-watch-url-to-external-service",
"$3.99 4K"
]
],
"Buy": [
[
"Apple TV",
"https://click.justwatch.com/super-long-just-watch-url-to-external-service",
"$14.99 4K"
],
[
"Amazon Video",
"https://click.justwatch.com/super-long-just-watch-url-to-external-service",
"$14.99 4K"
]
]
}
],
[
"The Matrix Reloaded",
"2003",
{
"Stream": [
[
"Max Amazon Channel",
"https://click.justwatch.com/super-long-just-watch-url-to-external-service",
"Subs HD"
],
[
"Max",
"https://click.justwatch.com/super-long-just-watch-url-to-external-service",
"Subs 4K"
]
]
"Buy": [
[
"AMC on Demand",
"https://click.justwatch.com/super-long-just-watch-url-to-external-service",
"$4.99 HD"
],
[
"DIRECTV",
"https://click.justwatch.com/super-long-just-watch-url-to-external-service",
"$11.99 4K"
]
]
}
],
[
"The Matrix Revolutions",
"2003",
{
"Stream": [
[
"Max Amazon Channel",
"https://click.justwatch.com/super-long-just-watch-url-to-external-service",
"Subs HD"
],
[
"Max",
"https://click.justwatch.com/super-long-just-watch-url-to-external-service",
"Subs 4K"
]
],
"Rent": [
[
"Apple TV",
"https://click.justwatch.com/super-long-just-watch-url-to-external-service",
"$3.99 4K"
],
[
"Amazon Video",
"https://click.justwatch.com/super-long-just-watch-url-to-external-service",
"$3.99 4K"
]
]
}
],
[
"The Matrix Revisited",
"2001",
{
"Rent": [
[
"Apple TV",
"https://click.justwatch.com/super-long-just-watch-url-to-external-service",
"$2.99"
],
[
"Amazon Video",
"https://click.justwatch.com/super-long-just-watch-url-to-external-service",
"$2.99"
]
],
"Buy": [
[
"Apple TV",
"https://click.justwatch.com/super-long-just-watch-url-to-external-service",
"$9.99"
],
[
"Amazon Video",
"https://click.justwatch.com/super-long-just-watch-url-to-external-service",
"$9.99"
]
]
}
]
]
(actual response has more options for services where you can access movies, I've trimmed it down for this example)
API will always respond with 5 best matching values, as JustWatch will match any string to something.
API doesn't return any additional details other than title, year and where to watch things. It looks only at search result site, it doesn't access individual movies/shows.
It responds always with 5 best matching entries as by default JustWatch loads only 5, and it will always load up something, regardless of whether input made any sense.
API is also quite slow, especially when running on less powerful machine, like Raspberry PI. That's the reason for limited details in responses.
This bot is in no way affiliated, associated, authorized, endorsed by, or in any way officially connected with JustWatch. This is an independent and unofficial project. Use at your own risk.