https://github.com/cecobask/imdb-trakt-sync
Automatic sync from IMDb to Trakt (watchlist, lists, ratings and history) using GitHub actions.
https://github.com/cecobask/imdb-trakt-sync
github-actions golang imdb trakt webscraping
Last synced: 6 months ago
JSON representation
Automatic sync from IMDb to Trakt (watchlist, lists, ratings and history) using GitHub actions.
- Host: GitHub
- URL: https://github.com/cecobask/imdb-trakt-sync
- Owner: cecobask
- License: mit
- Created: 2022-04-24T18:58:22.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2025-09-13T20:32:45.000Z (10 months ago)
- Last Synced: 2025-09-13T21:11:52.736Z (10 months ago)
- Topics: github-actions, golang, imdb, trakt, webscraping
- Language: Go
- Homepage:
- Size: 859 KB
- Stars: 112
- Watchers: 7
- Forks: 249
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/cecobask/imdb-trakt-sync/actions/workflows/sync.yaml)
[](https://github.com/cecobask/imdb-trakt-sync/actions/workflows/quality.yaml)
# imdb-trakt-sync

Command line application that can sync [IMDb](https://www.imdb.com/) and [Trakt](https://trakt.tv/dashboard) user data - watchlist, lists, ratings and history.
To achieve its goals the application is using the [Trakt API](https://trakt.docs.apiary.io/) and web scraping.
Keep in mind that this application is performing one-way sync from IMDb to Trakt. This means that any changes made on IMDb will be reflected on Trakt, but not the other way around.
# Configuration
FIELD NAME
DEFAULT VALUE
ALLOWED VALUES
DESCRIPTION
IMDB_AUTH
cookies
credentials
cookies
none
Authentication method to be used for IMDb:
credentials => IMDB_EMAIL + IMDB_PASSWORD fields required
cookies => IMDB_COOKIEATMAIN field required
none => IMDB_LISTS field required
IMDB_EMAIL
-
-
IMDb account email address. Only required when IMDB_AUTH => credentials
IMDB_PASSWORD
-
-
IMDb account password. Only required when IMDB_AUTH => credentials
IMDB_COOKIEATMAIN
-
-
Cookie value only required when IMDB_AUTH => cookies. Get the following cookie information from
your browser:
name: at-main | domain: .imdb.com
IMDB_LISTS
-
-
Array of IMDb list IDs that you would like synced to Trakt. If this array is not specified or empty, all
IMDb lists on your account will be synced to Trakt. In order to get the ID of an IMDb list, open it from a
browser - the ID is in the URL with format ls#########. If provided as GitHub secret or
environment variable, define its values as comma-separated list. Keep in mind the Trakt list limits!
IMDB_IGNOREDLISTS
-
-
Array of IMDb list IDs that you do NOT want synced to Trakt. This is useful if you would like to
sync all your lists, but ignore some. In order to get the ID of an IMDb list, open it from a browser - the
ID is in the URL with format ls#########. If provided as GitHub secret or environment variable,
define its values as comma-separated list.
IMDB_TRACE
false
true
false
Print tracing logs related to browser activities. Can be useful for debugging purposes
IMDB_HEADLESS
true
true
false
Whether to run the browser in headless mode or not. Only set this to false when running the syncer locally
IMDB_BROWSERPATH
-
-
The location of your preferred web browser. If you leave this value empty, the syncer will attempt to lookup
common browser locations. You can optionally override its value to use a specific browser
SYNC_MODE
dry-run
full
add-only
dry-run
Sync mode to be used when running the application:
full => add Trakt items that don't exist, delete Trakt items that don't exist on IMDb,
update
Trakt items by treating IMDb as the source of truth
add-only => add Trakt items that do not exist, but do not delete anything
dry-run => identify what Trakt items would be added / deleted / updated
SYNC_HISTORY
false
true
false
Whether to sync history or not. When IMDB_AUTH => none, history sync will be skipped
SYNC_RATINGS
true
true
false
Whether to sync ratings or not. When IMDB_AUTH => none, ratings sync will be skipped
SYNC_WATCHLIST
true
true
false
Whether to sync watchlist or not. When IMDB_AUTH => none, watchlist sync will be skipped
SYNC_LISTS
true
true
false
Whether to sync lists or not. This provides the option to disable syncing of lists
SYNC_TIMEOUT
15m
-
Maximum duration to run the syncer. Users with large libraries might have to increase the timeout value
accordingly. Valid time units are: ns, us (or µs), ms, s, m, h
TRAKT_CLIENTID
-
-
Trakt app client ID
TRAKT_CLIENTSECRET
-
-
Trakt app client secret
TRAKT_EMAIL
-
-
Trakt account email address (do NOT confuse with username)
TRAKT_PASSWORD
-
-
Trakt account password
# Usage
The application can be setup to run automatically, based on a custom schedule (_default: once every 12 hours_) using **GitHub Actions**, in a container, or locally on your machine.
Workflow schedules can be tweaked by editing the [.github/workflows/sync.yaml](.github/workflows/sync.yaml) file and committing the changes.
Please configure the application to suits your needs, by referring to the [Configuration](#configuration) section, before running it.
Follow the relevant section below, based on how you want to use the application.
## Run the application using GitHub Actions
1. [Fork the repository](https://github.com/cecobask/imdb-trakt-sync/fork) to your account
2. Create a [Trakt App](https://trakt.tv/oauth/applications). Use **urn:ietf:wg:oauth:2.0:oob** as redirect uri
3. Configure the application:
- Open your fork repository on GitHub
- Create an individual repository secret for each [Configuration](#configuration) field you need: `Settings` > `Secrets and variables` > `Actions` > `New repository secret`
4. Allow GitHub Actions on your fork repository: `Settings` > `Actions` > `General` > `Allow all actions and reusable workflows`
5. Enable the **sync** workflow: `Actions` > `Workflows` > `sync` > `Enable workflow`
6. Run the **sync** workflow manually: `Actions` > `Workflows` > `sync` > `Run workflow`
7. From now on, GitHub Actions will automatically trigger the **sync** workflow based on your schedule
## Run the application in a Docker container
1. Install [Docker](https://www.docker.com/get-started)
2. Clone the repository: `git clone git@github.com:cecobask/imdb-trakt-sync.git`
3. Create a [Trakt App](https://trakt.tv/oauth/applications). Use **urn:ietf:wg:oauth:2.0:oob** as redirect uri
4. Configure the application:
- Create `.env` file with the same contents as [.env.example](.env.example)
- Populate the `.env` file with your own secret values
- All secret keys should have `ITS_` prefix
5. Open a terminal window in the repository folder and then:
- Build a Docker image: `make package`
- Run the sync workflow in a Docker container: `make sync-container`
## Run the application locally
1. Install [Git](https://git-scm.com/downloads) and [Go](https://go.dev/doc/install)
2. Clone the repository: `git clone git@github.com:cecobask/imdb-trakt-sync.git`
3. Create a [Trakt App](https://trakt.tv/oauth/applications). Use **urn:ietf:wg:oauth:2.0:oob** as redirect uri
4. Open a terminal window in the repository folder and then:
- Build the syncer: `make build`
- Configure the syncer: `make configure`
- Run the syncer: `make sync`