- Fast and gets the job done; built mainly for the sole purpose of porting over anime data from AnimePlanet's database to MyAnimeList's database.
- Lightweight; only two third party dependancies are used -
requests
andpython-dotenv
. - Simple to use; simply put in your exported list from AnimePlanet and it'd do wonders, though some human intervention may be needed.
- Comes pre-packaged with a local database that will expand gradually over use since both sites have name discrepancies.
- Your list on either sites can be private, as long as you authorise the MAL client app.
- Unable to update
is_rewatching
value in MyAnimeList since AnimePlanet did not include any likewise data when exporting. - Scores on AnimePlanet will multiply by 2 when updating score in MyAnimeList since the latter has scores up til 10.
- Number of watched episodes and amount of times rewatched will update accordingly.
- The properties,
priority
andrewatch_value
in MyAnimeList will be left out when porting over, similar tois_rewatching
. - Same goes for
Start Date
andFinish Date
as the official MyAnimeList API does not include any endpoints to update those values. - If an anime in AnimPlanet has a status of
won't watch
it will be converted todropped
since there are no corresponding values in MyAnimePlanet. - With regards to MyAnimeList's API behaviour, it will override old data if new data is pushed to its server.
- There are some entries in AP's database where it is bundled as one whereas over on MAL's database, such as AP[0], AP[1] and MAL[0].
- MAL entry had the two episodes bundled together as one show whereas AP had the two episodes separate.
- Considered a caveat since the expected behaviour is to just map the two episodes (technically one show) from AP to the one MAL ID.
- The status/ratings would be overrided for whichever is ported last.
- For querying anime data in MAL, due to restrictions imposed by its API, the anime name will be repeated if the name on AP consists lesser than 3 characters in order to make it 3 characters long.
- Tried padding it with spaces (both with and w/o urlsafe encoding), didn't work.
- Ineffective, may need to manually source the MAL ID.
Uses the exported list provided by user.
Iterates through exported list and tries to find entry in local database (matched anime's name on AP's database with MAL ID).
If no matching entry found within local database, it'll query and try to automatically find the matching anime on MyAnimeList (both sites might have name discrepancies for the same anime).
If it finds none matching ( < 100% match), you would be given a list which contains up to 5 animes, ranking from the most relevance to the least; input the number to select.
If returned list does not contains any matching results, an input
0
will allow you to type in the anime ID on MyAnimePlanet.
Else, input-3
to skip.
After that is done it will add the anime name with its corresponding MAL ID into the local database.
Proceeding with the next anime in the exported list.
At the very end, upon user's confirmation it will port all the anime that were managed to be matched with an anime id to MyAnimeList.
The list of instructions is created with being able to cater to people of different skillsets in mind.
Setting up a MyAnimeList's app will allow you to access its API.
Refer to here for the guide.
Key takeaways of the guide:
Create a MyAnimeList's app
GetCLIENT_ID
andCLIENT_SECRET
You will need these two later.
NOTE: The CLIENT_SECRET
should be treated as a confidential item, like a password, do not share it around.
Refer to here.
Above guide is meant for people who are unfamiliar with the Git workflow and has no experience with Python.
Key takeaways of the guide:
Being able to use
git
command in your terminal and clone the repository to your local system
Being able to usepy
/python
command in your terminal
This will remove the need of getting git
.
Create a .env
file, its name can be anything really.
Just make sure it ends with the .env
file extension.
Save the file within the project folder, AP_MALPorter
.
In it, create two variables and fill them up with the values obtained from Step 1.
CLIENT_ID
and CLIENT_SECRET
, word for word, case sensitive.
It should look something like this:
CLIENT_ID = be55d6f36dfbed4
CLIENT_SECRET = 5aeed4fd04ff666e61fc573800baa2019516263d6531178174be81f0da53f51e
Log in to AnimePlanet and head over to www.anime-planet.com/users/export_list.php to export your anime data.
Name it whatever you want (needs to end with .json
though), you'll be asked to input it in later.
Highly advise you to save it alongside the .env
file, in the project folder, AP_MALPorter
, if you're not too well-versed with directories.
There are only two dependancies that this project requires as of so far.
Check this section.
Navigate to the cloned repo and run:
pip install -r requirements.txt
You can either run the code with your terminal or by simply clicking on the __main__.py
script in the project folder.
Right now, I am under the assumption that the cloned project folder is stored in C:\Users\faded\Desktop
so the absolute path to the cloned project folder is C:\Users\faded\Desktop\AP_MALPorter
.
Using the cd
command, navigate to the folder where the cloned project folder is stored.
(afaik, Windows, Linux, macOS uses the same command)
Then run the follow command, (Windows)
py AP_MALPorter
OR if you're using linux
python AP_MALPorter
Supposing you didn't change the name of the folder and kept it as "AP_MALPorter".
Note:
Your working directory is the parent folder of the cloned project folder. In our case,
C:\Users\faded\Desktop
So when you are trying to refer to another file, it is best to use absolute paths or if relative paths are used, keep in mind of your working directory
E.g. You want to reference the database file that is in the cloned project folder, you would doAP_MALPorter/database.json
Without using the terminal, simply clicking the __main__.py
script will execute the Python
script for you, granted you had set up Python correctly.
Note:
Unlike running the code via the terminal, your working directory is now within the cloned project folder
So if you want to reference a file (let's saydatabase.json
) which is insideAP_MALPorter
using relative paths, you would simply dodatabase.json
You will not be able to capture the error messages fast enough if an error were to happen as the Python prompt would just close straight away.
CLI stands for "Command Line Interface".
It comes packed with a few commands to get you started.
Read here for more on it.
And you're done!
Here are a list of third party dependencies needed to be installed,
Easy installation, simply by using the requirements.txt
file in the repository.
pip install -r requirements.txt
This section is to give you a guide on how to resolve thrown errors.
Contacting me would be a wise move when you cannot resolve these errors by yourself.
Desc: Your local database inputted file is not a .json
file.
Fix: Ensure that the file you inputted for the local databse is a valid .json
file.
Desc: Your local database inputted file is not formatted nicely or may be blank.
Fix: Ensure that your .json
file has some contents in it. If it is blank, just writing "{}" into it is sufficient enough.
Desc: Your local database inputted file is not a valid file because it does not exists.
Fix: Ensure that the file you inputted for the local database exists in your system.
Desc: Preferences file is not present in the /cache
folder under project folder, AP_MALPorter
.
Fix: Create a new .json
file, name it saves.json
and save it under the /cache
folder under project folder.
Desc: Preference file - saves.json
file under /cache
folder in project folder, is empty.
Fix: Ensure that saves.json
has atleast {}
written to it.
Desc: Internal error with the scripts; ap_parser.py
was never intialised yet functions are called.
Fix: Contact me
Desc: Inputted file for your AnimePlanet export list does not exists.
Fix: Ensure that the inputted file does exists in your local system and the path is correct.
Desc: Inputted file for your AnimePlanet export list contains nothing.
Fix: Ensure that your exported file contains the exported anime data.
This error only occurs when the inputted file is empty.
Desc: Inputted file for your AnimePlanet is malformed, as it has a missing key, "entries".
Fix: Ensure that the .json
file you're getting from AnimePlanet's side is correct and is not empty.
This error is only thrown when the export file has the missing key, "entries", which contains all the exported anime data.
Error should not appear and if it does, it is most likely on AnimePlanet's side else they may have changed the schematics of their exported .json
file.
Desc: Internal error with the scripts; mal_interactor.py
was never initialised yet its functions were called.
Fix: Contact me
Desc: Internal error with the scripts; mal_interactor.py
's authenticate()
function was called more than once.
Fix: If you modified the scripts, ensure authenticate()
is only called once as there is no reason to obtain the access token twice.
Else, if the error pops out of nowhere, contact me.
Desc: Missing auth_params.json
file to store the cache of the access token and refresh token.
Fix: Ensure a the filepath exists, FILEPATH
, and write "{}" into its contents. (.json
file)
Desc: FILEPATH
is empty. .json
contents can never be empty.
Fix: Write "{}" into FILEPATH
and save.
Desc: Required local environment variable, CLIENT_ID
required.
Fix: Ensure you have stored the correct CLIENT_ID
you've acquired from setting up in a .env
file stored somewhere in the project folder locally with the key, CLIENT_ID
.
Desc: Required local environment variable, CLIENT_SECRET
required.
Fix: Ensure you have stored the correct CLIENT_SECRET
you've acquired from setting up in a .env
file stored somewhere in the project folder locally with the key, CLIENT_SECRET
.
Desc: After authorisation your app, giving an invalid input of the redirect url will throw this warning
Fix: Ensure you have copied and pasted the full url after authorising access, word for word.
The entire url should look something like this:
redirecturl/?code=longstringofcharacters&state=amistillintact
With redirecturl
being the one you set in setting up.
E.g. https://myanimelist.net/
Desc: Internal error; when making the authorisation request with the state amistillintact
, returned state is not the same after authorisation by user.
Fix: Something has went wrong, contact me.
Desc: Internal error; when trying to get the access token, MAL API threw an error.
Fix: Ensure your CLIENT_ID
and CLIENT_SECRET
is valid.
You might need additional help from me, contact me.
Desc: Used as a catch-all error when MAL API complains about any requests.
Fix: No general fixes, but contacting me should help.
Again, if any of the fixes does not fix your issue, feel free to contact me along with the given context.
Create a new issue or
Contact me on Discord: carsoccerfan#7171