Python scripts that use the Trakt API to export movie and episodes from trakt lists to a csv file, and import them back to any Trakt account. This project is essentially an updated version of the csv import/export functionality of xbgmsharp/trakt.
You must use Python 3.x.
To install requirements:
$ pip install -r requirements.txt
- Create an Trakt.tv application to have your own
client_id
andclient_secret
, https://trakt.tv/oauth/applications. You only need to fill up theName
with aDescription
andRedirect uri
tourn:ietf:wg:oauth:2.0:oob
, leave the rest empty and click onSAVE APP
. - Run the script to create a default config file
config.ini
$ python export_trakt.py
- Edit the config file
config.ini
. You must specifyclient_id
client_secret
username
- any other settings appropriate to your environment, eg: URL, proxy, etc...
- Run the script to authenticate against Trakt.tv API using the PIN method.
$ python export_trakt.py
- In the CLI, you will be prompted to open a link into a browser and paste the pincode back to the script. You should only need to do this once.
For help, run
$ python import_trakt.py -h
The following command will import all movies in m.csv
to the default history list in Trakt with the watched_at
and the trakt
id columns specified in m.csv
.
$ python import_trakt.py -c config.ini -f trakt -i m.csv -l history -t movies -w
The following command will import all episodes in e.csv
to the default history list in Trakt with the trakt
id columns specified in e.csv
, with a watched_at
date set to 2014-01-01T00:00:00.000Z
.
$ python import_trakt.py -c config.ini -f trakt -i e.csv -l history -t episodes -s 2014-01-01T00:00:00.000Z
The following command will import all movies in m.csv
to a custom user list using the trakt
id columns specified in m.csv
.
$ python import_trakt.py -c config.ini -f trakt -i m_f.csv -t movies -u
The user will have to provide the id of the user list they want to import to.
Found 2 user list(s)
id | name
21358741 | test2
21369802 | test
Type in the id matching with the name of the list you want to import item(s) to.
Input:
For help, run
$ python export_trakt.py -h
The following command will export all movies in Trakt's default history list to m.csv
.
$ python export_trakt.py -c config.ini -t movies -o m.csv -l history
The following command will export all episodes in Trakt's default history list to e.csv
.
$ python export_trakt.py -c config.ini -t episodes -o e.csv -l history
The following command will export all movies from a custom user list to test2.csv
.
$ python export_trakt.py -c config.ini -t movies -o test2.csv -u
The user will have to provide the id of the user list they want to export, or all
for all user lists. This will export them in to csv files with the name of the user list.
Found 2 user list(s)
id | name
21358741 | test2
21369802 | test
Type in the id matching with the name of the list you want to export, or 'all' for all lists.
Input: