This is a personal project, that could be interesting for other people in the same situation as I was.
I discovered Movary, and wanted to start to use it to track the movies I watch.
Until now, I was using The Movie Database to store this information, but as I want to keep 100% control of my data, I chose Movary.
So this is a small script to automatize the export of my ratings from The Movie Database and import them into Movary.
Run this script and import the data on you own risk, I recommend try it first on an empty instance of Movary to avoid data loses, or at least make some backups if you have some previous data.
- You need an api key from The Movie Database.
- You need an instance of Movary
You need to take some data and put it into the script.
At the top of the script, you can find some strings with the text FILL_WITH_YOUR_VALUE, just replace it, with your own values.
tmdb_api_key: here you need to take the api key from your profile in the movie database.
movary_url: You need to enter the url for your Movary instance. For examplehttps://movary.mydomain.com
The last two elements you need to fill are a bit more complex.
movary_cookie_value: The value of the cookie named idmovary_php_session_cookie: The value of the cookie named PHPSESSID
To get these values you need to login to your instance of Movary in your browser, open the Developer Tools (F12 for example).
After this, go to Application, and select Cookies from your movary instance, there your should see a couple of cookies, copy the values, in the picture you can see them on red and yellow, and paste them to the script.
To run the script, just be sure that you have node installed on your computer, at least Node 18.*
npm install
node tmdb-to-movary.js
While the script is running you get some information about the process of importing data from The Movie Database, and the results of the importation of the movies to Movary.
When you start the script, a message asking for authenticate you on The Movies Database website will be prompted.
Just click on the link, or copy/paste to your browser, login, and approve the request, and everything starts automatically.
The list of movies from TMDB, will be stored on a file called movies.json in the project root, so you can check it after it, or commenting the part of the insertion to Movary, make a dry-run.



