MyAnimeList-Module (NPM)
MyAnimeList Module This module is neither affiliated with nor endorsed by MyAnimeList. All data returned by this module is provided by MyAnimeList. Version 1.0.5 Installation Install myanimelist-module with npm npm install myanimelist-module Usage/Examples const { MyAnimeList } = require ( ' myanimelist-module ' ) const mal = new MyAnimeList ({ client_id : `YOUR_MAL_CLIENT_ID` // Get it here:…
The MyAnimeList Module is a JavaScript package that allows developers to interact with the MyAnimeList API. It is important to note that the module is not affiliated with or endorsed by MyAnimeList. The module's functionality is provided directly by MyAnimeList. Version 1.0.5 of the module is currently available.
To use the module, one must first install it using the npm command: `npm install myanimelist-module`. After installation, the module can be imported and used in a JavaScript project.
Here is a basic example of how to use the module:
```javascript
const { MyAnimeList } = require('myanimelist-module')
const mal = new MyAnimeList({
client_id: 'YOUR_MAL_CLIENT_ID' // Obtain this from https://myanimelist.net/apiconfig
})
async function test() {
const response = await mal.getAnimeInfo({ name: 'Anime name' })
if (response.error) {
console.error(response.error)
} else {
console.log(response.datas)
}
}
test()
```
In this example, the `MyAnimeList` object is created with your MyAnimeList Client ID. The `getAnimeInfo` function is then called with the name of an anime as the parameter. If the response contains an error, it is logged to the console. If not, the anime data is logged.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.